sazizrahman - I answered the same question you also posted here:
http://www.wrensoft.com/forum/showthread.php?t=4816
[Apache@Win] After Submitting a search: "Premature end of script headers"
Collapse
X
-
Originally posted by wrensoft View PostYou normally get this error is the server is configured to run .CGI scripts as Perl. Zoom is not a Perl script, thus you get an error.
See also this FAQ for other details of how to get the CGI setup.
Also check that you have use the Windows version of the search.cgi (not the Unix or Linux release). You can rename the search.cgi file to be search.exe and run it in DOS to check that it is the Windows version.
Can i used the renamed "search.exe" to get the results in DOS somehow. e.g.
search.exe zoom_query=Engineering
Leave a comment:
-
We've just tested with a copy of XAMPP (both an old version V1.1.1.2, and the latest V1.7.2) and the CGI ran successfully with the default httpd.conf settings with no changes needed in the configuration file. We also tried a large index (over 100,000 pages) and it ran without issue.
Try placing it globally, outside the mime_module settings.Originally posted by toby View PostBut I'm not sure: Does the PHP Memory Limit also take effect on the Memory Limit for CGI's?
Or is my httpd.conf wrong? Do I have to put the three directives (RLimitMem, RLimitCPU and Timeout) somewhere else?
These limits are not PHP limits exclusively. They are Apache limits for any process that it spawns. Since PHP is a script engine that is sometimes installed as a CGI and sometimes as a module, it too has to obey these limits.
You might want to check if you have any anti-virus/security programs which might be interferring as well.
If you still have trouble, zip up the set of index files which is not working, and e-mail them to us. We can verify if the files are okay.
Leave a comment:
-
Yes, this makes sense... I have to admit, that I'm fairly new to CGI and configuring an Apache.
I changed my httpd.conf to this:
But the result is still the same :/Code:<IfModule mime_module> TypesConfig conf/mime.types AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddType application/x-httpd-php .php AddType application/x-httpd-php .php3 RLimitMEM 1073741824 1610612736 RLimitCPU 300 420 Timeout 300 AddHandler cgi-script .cgi AddType text/html .shtml AddOutputFilter INCLUDES .shtml </IfModule>
So, I've slightly modified your PHP "Test" script to this:
The script end; I see the "End test loop"-line.PHP Code:<?php $num_of_int = 20000000; print("<h1>Begin test loop to allocate memory for {$num_of_int} integers</h1></ul>"); for ($i = 0; $i < $num_of_int; $i++) { $dict[$i] = $i; if ($i % 5000 == 0) { print("<li>allocated memory for {$i} integers.</li>"); } } print('</ul><h2>End test loop</h2>'); ?>
But I'm not sure: Does the PHP Memory Limit also take effect on the Memory Limit for CGI's?
Or is my httpd.conf wrong? Do I have to put the three directives (RLimitMem, RLimitCPU and Timeout) somewhere else?
Leave a comment:
-
You might also want to have a look at this old post, which is an Apache configuration issues that causes PHP scripts and CGI's to die before they can finish executing.
http://www.wrensoft.com/forum/showthread.php?t=12
The larger the set of index files to more likely you are to have this problem.
Leave a comment:
-
Hi again!
I deinstalled my Zoom Search Engine (+ Plugins) from our computer. After that, I cleaned both directories: The installation directory and the "Wrensoft" folder inside the Own Docs/All Users/App data/.
Then, I downloaded the the current version and installed it. Zoom's "Help/About" confirms that I'm now on Build 1018. After installing the plugin-set and configuring my Zoom, I started indexing again... Same problem.
Then, I started to change some settings... Depending on the massive files (mainly PDF) we have, I set up Zoom's limits/configs to this:- Skip options: Skip words less than 3 chars
- Indexing options: Indexing word rules: all character to join words are checked
- Limits: max files: 20,000 // max unique words: 1,250,000 // max file size: 153,600 KB (150.00 MB) // max desc length: 150 chars // none of the four checkboxes are checked
- Languages: UTF-8 // German.zlang // Stemming enabled for German // International search options: Enable accents/diacritic insensitivity for: accents, umlauts, ligature are checked // Use digraphs for umlauts is checked // substring match is checked
I saved this config file and started indexing, but there was no change in the result...
Then, I started indexing again (same config), but I stopped it after Zoom has approx. 3000 files indexed (before, when Zoom searches the whole directory, it has approx. 9500 files indexed). This does work!
So I guess it is because of the amount of unique words (~980,000) in ~9500 PDF documents. I think it has something to do with Zoom's database files (*.zdat) or its filesizes. Here is a comparison between the not working files (indexed ~9500 files with ~980,000 unique words) and the working one (indexed ~3000 file with ~500,000 unique words)
Code:SUMMARY ============================================================== | WORKING | NOT WORKING -------------------------------+---------------+-------------- files indexed | 3000 | 9570 unique words | 497,905 | 977,395 total words | 11,242,464 | 37,412,160 total bytes scanned/downloaded | 3,486,371,083 | 1,912,882,797 FILE SIZE ============================================================== | WORKING | NOT WORKING -------------------------------+---------------+-------------- dictionary.zdat | 14,714 KB | 31,105 KB pagedata.zdat | 557 KB | 1,742 KB pageinfo.zdat | 50 KB | 159 KB pagetext.zdat | 54,732 KB | 187,657 KB wordmap.zdat | 21,253 KB | 55,249 KB --- (WORKING = stopped indexing after 3000 files) (NOT WORKING = indexed full directory; 9500 files)
I tried this: This takes no effect; same behaviour between "AddHandler cgi-script .cgi .pl .asp" and "AddHandler cgi-script .pl .asp" (yes, I did restart Apache after changing the httpd.conf).Originally posted by Ray View PostIf you still have trouble after doing the above, try changing this line in your XAMPP config:
AddHandler cgi-script .cgi .pl .asp
To this:
AddHandler cgi-script .pl .asp
Thanks again for your help !
Last edited by toby; Oct-08-2009, 09:21 AM.
Leave a comment:
-
No. I even deleted those and changed the output directory, but this didn't help either.Originally posted by Ray View PostDid you ever open the ZDAT files in another program (like MS Word or similar)? Did you ever transfer them over FTP?
We just run one planned task on this machine. So no, we mix nothing.Originally posted by Ray View PostDid you mix index files produced from different index sessions? Looking over past support queries with this error, one user claimed he tried to use the index files generated for the PHP option with the CGI, and it caused similar issues.
Jep, I'll try this and post my results.Originally posted by Ray View PostTo be thorough, you might want to download and install the latest build of Zoom (you're a few builds behind), and re-index your content (making sure CGI/Win32 is selected).
If you still have trouble after doing the above, try changing this line in your XAMPP config:
AddHandler cgi-script .cgi .pl .asp
To this:
AddHandler cgi-script .pl .asp
And I greatly appreciate that! --Thanks again!Originally posted by Ray View PostBut I am only guessing here since I can't test out the configuration.
Leave a comment:
-
I wonder if you have a corrupt set of index files. Did you ever open the ZDAT files in another program (like MS Word or similar)? Did you ever transfer them over FTP?
Did you mix index files produced from different index sessions? Looking over past support queries with this error, one user claimed he tried to use the index files generated for the PHP option with the CGI, and it caused similar issues.
To be thorough, you might want to download and install the latest build of Zoom (you're a few builds behind), and re-index your content (making sure CGI/Win32 is selected).
This means it is just dumping the contents of the binary file and treating it as text, instead of executing it. So it's definitely not configured as needed when it's doing this.Originally posted by toby View PostIf I change from "cgi-script" to "cgi-handler" I get many hieroglyphs including "This program cannot be run in DOS mode".
If you still have trouble after doing the above, try changing this line in your XAMPP config:
AddHandler cgi-script .cgi .pl .asp
To this:
AddHandler cgi-script .pl .asp
But I am only guessing here since I can't test out the configuration.
Leave a comment:
-
Hi again and thanks for your tips!
If I change from "cgi-script" to "cgi-handler" I get many hieroglyphs including "This program cannot be run in DOS mode".
So I set up a fresh and new VM (Win XP) where I installed XAMPP 1.7.2.
I just copied the following files to the "c:/xampp/cgi-bin/"-directory:- search.cgi
- search_template.html
- settings.zdat
- zoom_dictionary.zdat
- zoom_pagedata.zdat
- zoom_pageinfo.zdat
- zoom_pagetext.zdat
- zoom_wordmap.zdat
On this machine, the following lines of code are default (httpd.conf):
This confuses me: There is also "cgi-script" instead of "cgi-handler", but It works... kinda, because the "Search template" shows up if I go to http://localhost/cgi-bin/search.cgi. But: After entering a query and submitting the form, I get an 500-Error and my Apache Log says "Premature end of script headers: search.cgi, referer: http://localhost/cgi-bin/search.cgi?zoom_sort=0&zoom_xml=0&zoom_query=ks0&z oom_per_page=10&zoom_and=0".Code:<Directory /> Options FollowSymLinks AllowOverride None Order deny,allow Deny from all </Directory> <Directory "C:/xampp/htdocs"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> <IfModule alias_module> ScriptAlias /cgi-bin/ "C:/xampp/cgi-bin/" </IfModule> <Directory "C:/xampp/cgi-bin"> AllowOverride None Options None Order allow,deny Allow from all </Directory> <IfModule mime_module> TypesConfig "conf/mime.types" AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddHandler cgi-script .cgi .pl .asp AddType text/html .shtml AddOutputFilter INCLUDES .shtml </IfModule>
After trying over a dozen of keywords, I found out that this is not the default behavior! Sometimes, there are results! I repeat: There are results, depending on the query...
I have say, that we've got many documents to index. Here is the summary from our search.log:
The most confusing part is, that sometimes, it works and sometimes not. As I said, it depends on the search query. E.g. the search "bg0" returns the Error 500 Document and the search for "ks0" returns the correct results...Code:All index files will be written to: D:\wamp\www\zoom-search Writing index data for CGI/Win32 search... (Please wait) Created pagedata data file (zoom_pagedata.zdat) Created pagetext data file (zoom_pagetext.zdat) Created pageinfo data file (zoom_pageinfo.zdat) Created dictionary data file (zoom_dictionary.zdat) Created wordmap data file (zoom_wordmap.zdat) Created script settings file (settings.zdat) Indexing completed at Tue Oct 06 03:56:09 2009 INDEX SUMMARY Files indexed: 9533 Files skipped: 1325 Files filtered: 0 Files downloaded: 0 Unique words found: 990887 Variant words found: 825889 Total words found: 37957731 Avg. unique words per page: 103.94 Avg. words per page: 3981 Start index time: 03:00:02 (2009/10/06) Elapsed index time: 00:56:07 Peak physical memory used: 331 MB Peak virtual memory used: 1055 MB Errors: 617 Total bytes scanned/downloaded: 1922616626 File extensions: .cfm indexed: 0 .pdf indexed: 7215 .doc indexed: 0 .docx indexed: 0 .ppt indexed: 0 .pptx indexed: 0 .xls indexed: 0 .xlsx indexed: 0 .jpg indexed: 2318 .gif indexed: 0 .png indexed: 0 .bmp indexed: 0 Cleaning up memory used for index data... please wait. Finished cleaning up memory. Copied search script to: D:\wamp\www\zoom-search\search.cgi Successfully created all required files
Thanks in advance for your support!
Leave a comment:
-
Did you read the page that was linked to above? There's a section about httpd.conf specifically.
You need to change it to either use "cgi-handler" instead of "cgi-script" or allow ".exe" files to execute under Apache.
Leave a comment:
-
Thanks for your fast answer!
I am using the Windows version: If I rename search.cgi to search.exe and run it from CMD, it returns:
Code:Content-type: text/html <h3>Request method error</h3>
I guess it is something with my httpd.conf... As I mentioned before, we run the WAMP Server. I changed the httpd.conf to this:
d:/wamp/www/ = root directoryCode:### some parts are not listed ### DocumentRoot "d:/wamp/www/" <Directory /> Options FollowSymLinks AllowOverride None Order deny,allow Deny from all </Directory> <Directory "d:/wamp/www/"> Options Indexes FollowSymLinks MultiViews Includes ExecCGI AddHandler cgi-script .cgi AllowOverride all Order Allow,Deny Allow from all </Directory> <IfModule dir_module> DirectoryIndex index.php index.php3 index.html index.htm index.cgi </IfModule> <FilesMatch "^\.ht"> Order allow,deny Deny from all Satisfy All </FilesMatch> <IfModule alias_module> ScriptAlias /cgi-bin/ "d:/wamp/www/zoom-search/" </IfModule> <Directory "d:/wamp/www/zoom-search"> AllowOverride None Options None Order allow,deny Allow from all Options Indexes FollowSymLinks MultiViews Includes ExecCGI AddHandler cgi-script .cgi </Directory>
d:/wamp/www/zoom-search = here are search.cgi, search_template.html and *.zdat located
But this doesn't work neither...
Thanks in advance for your help!!
Leave a comment:
-
You normally get this error is the server is configured to run .CGI scripts as Perl. Zoom is not a Perl script, thus you get an error.
See also this FAQ for other details of how to get the CGI setup.
Also check that you have use the Windows version of the search.cgi (not the Unix or Linux release). You can rename the search.cgi file to be search.exe and run it in DOS to check that it is the Windows version.
Leave a comment:
-
[Apache@Win] After Submitting a search: "Premature end of script headers"
Hi there,
I've got the following problem with the results page:
If I open the search (without passing any params), everything is as it should be. But after submitting a search term,
I get the following error message:
Code:Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, foo@bar.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log.
My Apache Error Log says:
Code:[error] Premature end of script headers: search.cgi, referer: http://example.com/zoom-search/search.cgi
This is the server environment:- Windows Server 2003 R2, Standard Edition, Service Pack 1
- Zoom Search Engine Version 6.0 (Build: 1016) Enterprise Edition
- WAMP Server Version 2.0 with an Apache 2.2.11 (no IIS!)
Zoom is configuered to put out an CGI/WIN32 file, because we have approx. 1.000.000 unique words.
My .htaccess file looks like this:
And the httpd.conf looks like this:Code:# PHP settings php_value memory_limit 1024M php_value max_input_time 300 php_value max_execution_time 300 # everything should be UTF-8 encoded AddDefaultCharset UTF-8 # remove index.php RewriteEngine On RewriteCond $1 !\.(gif|jpe?g|png)$ [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/$1 [L] Options +FollowSymLinks
Code:ServerRoot "d:/wamp/bin/apache/apache2.2.11" Listen 80 # LOADED MODULES ARE NOT LISTED <IfModule !mpm_netware_module> <IfModule !mpm_winnt_module> User daemon Group daemon </IfModule> </IfModule> ServerAdmin foo@bar.com ServerName foobar:80 DocumentRoot "d:/wamp/www/" <Directory /> Options FollowSymLinks AllowOverride None Order deny,allow Deny from all </Directory> <Directory "d:/wamp/www/"> Options Indexes FollowSymLinks MultiViews Includes ExecCGI AddHandler cgi-script .cgi .pl AllowOverride all Order Allow,Deny Allow from all </Directory> <IfModule dir_module> DirectoryIndex index.php index.php3 index.html index.htm index.cgi </IfModule> <FilesMatch "^\.ht"> Order allow,deny Deny from all Satisfy All </FilesMatch> ErrorLog "d:/wamp/logs/apache_error.log" LogLevel warn <IfModule log_config_module> LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %b" common <IfModule logio_module> LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio </IfModule> CustomLog "d:/wamp/logs/access.log" common </IfModule> Options +ExecCGI AddHandler cgi-script .cgi AddHandler cgi-script .pl DefaultType text/plain <IfModule mime_module> TypesConfig conf/mime.types AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddType application/x-httpd-php .php AddType application/x-httpd-php .php3 </IfModule> Include conf/extra/httpd-autoindex.conf <IfModule ssl_module> SSLRandomSeed startup builtin SSLRandomSeed connect builtin </IfModule> Include "d:/wamp/alias/*"
I do not let Zoom upload any files, because I've set the "Output directory" to:
which can be accessed by typing http://example.com/zoom-search/Code:D:\wamp\www\zoom-search
Do you have any idea how to solve my problem?
Thank you guys very much!
Best regards,
TobyTags: None
Leave a comment: