The following reply was made to PR os-linux/4941; it has been noted by GNATS.
From: "Steven Van Poeck" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Subject: Re: general/4941 Date: Wed, 20 Oct 1999 11:36:43 +0200 In bug report 4941 is written: ---------- In a page (.html) exists a command <!--#exec cgi="/cgi-bin/counter" --> The page is loaded but the counter not register a number and not increment a visit in access_count file.in apache´s erro_log look this: [Tue Aug 31 21:41:17 1999] [error] (2)File or directory not found: exec of /home/httpd/cgi-bin/counter failed [Tue Aug 31 21:41:17 1999] [error] [client 172.28.1.1] Premature end of script headers: /home/httpd/cgi-bin/counter All .conf file are right. This script run with apache-1.3.3. with no problems. >How-To-Repeat: >Fix:something in mod_alias ou mod_cgi, im not sure! ---------- I've just had this error too and after applying all of the suggested fixes in the FAQ (and thouroughly sc**wing up my Apache 1.3.6-7 configuration), I still got these error messages in /var/log/httpd/error_log: <SNIP> [Wed Oct 20 10:40:21 1999] [error] (2)No such file or directory: exec of /home/web/cgi-bin/scheduler/pbtest.cgi failed [Wed Oct 20 10:40:21 1999] [error] [client 192.168.1.2] Premature end of script headers: /home/web/cgi-bin/scheduler/pbtest.cgi </SNIP> NOTE : These two lines are _always_ coupled. I finally found out what this was due to. I use HomeSite 4.0 to develop my code (HTML, Perl etc...). This program _still_ does not exist for Unix platforms, so I use it on a Windows NT4 SP3 Workstation and send the lot through the built-in HomeSite FTP client to the Apache web server (on an Intel i686 RedHat 6.0). HomeSite can be configured to save files in PC, Unix or Macintosh format. My files were saved on the Apache server in PC format. There's nothing wrong with that as long as you do not use the Common Gateway Interface (CGI): HTML files work fine, text files too, executing the Perl script directly on the linux box's command line works fine too. But from the moment your (PC format saved) script is being mangled through the CGI (i.e.: you're requesting the execution of the script from a remote client -- the Windows NT4 SP3 Workstation on IP address 192.168.1.2 in my case), you get the incriminated error. I changed the HomeSite option to save files in Unix format and my troubles were over. It must be the difference in CR/LF between the PC and the Unix world that cause this error, the Apache server esteeming that the trailing PC CR/LF is a file and not finding it (whence the first error line). Or it attaches a trailing PC CR/LF to the Perl scipt filename and can't find it. Either of these, I guess. I think it would **really** be a good idea to put this *simple* check 1st in place in the FAQ concerning the "Premature end of script headers" item: "Are you saving your files in PC format and your Apache server is running on a Linux machine? Save your files in Unix format !"... It would certainly save a lot of time and misery to those working in mixed environments (I spent more then 5 hours in two days finding the origin of my problem). You can easily reproduce the problem: 1/ Write and save a simple "Hello, world" Perl script on a PC. (I only tested with Perl) 2/ FTP the file up to a cgi-bin directory on any Apache server running on a Linux machine. (Maybe the problem goes for all Unix machines, I don't know) 3/ Call the script through CGI from a remote client (http://www.some-domain.tld/cgi-bin/hello.cgi ) 4/ Check the error_log for the Apache server while doing so. Best regards, Steven Van Poeck France Telecom Interactive / Wanadoo - http://www.wanadoo.fr/ Tel : +33 (0)1 41 33 04 22 / Fax : +33 (0)1 41 33 04 10 E-Mail: mailto:[EMAIL PROTECTED]