LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   Premature end of script headers (https://www.linuxquestions.org/questions/red-hat-31/premature-end-of-script-headers-181983/)

webhead 05-16-2004 04:13 AM

Premature end of script headers
 
I just recently changed my server over from Windows 2000 to Redhat Linux 9. Now what I did was mount my old C drive in /mnt/windows and just used all the same stuff. I then copied the cgi-bin files to /var/www/cgi-bin. The problem now is that is keeps giving me that error "Premature end of script headers". Now, I tried the whole "#!/usr/bin/perl -w" thing, and it seemed to work, but in reality, the scripts did not actually worked, they simply stopped giving me errors. Does anyone have any idea what the problem might be? I don't have anything special going on with Apache, its basically just like it was when I installed it. :cry:

Hopefully someone can help me, I have been trying to fix this thing forever :-/

webhead 09-18-2004 06:13 PM

^bump^
I recently just installed RH9 on a different computer and am having the exact same problem. I messed with all KINDS of permissions and nothing will help. I ran the script from the command line, just for shits and giggles, and there are no errors there.

Someone please help me, is there some kind of daemon I need to be running, or some kind of program that I am forgetting to run? Is there something I need to add to my apache config file besides ExecCGI or Addhandler .cgi and .pl? ANY suggestions that ANYONE has would be GREATLY helpful.

manvirr 09-21-2004 01:57 AM

try copying the perl scripts under the /cgi-bin directory of your website. Or make changes in httpd.conf file to poing cgi-bin to the directory where your files are stored. In some cased apache has problems with file permissions too. So try copying the files into a ext2 / ext3 partition and pointing the cgi-bin to that directory. This should work.

misc 09-21-2004 02:13 AM

The Apache FAQ covers the "premature end of script headers" topic in detail. Various defects can be the cause, not limited to: Windows-specific line delimiters (run 'dos2unix' on the files), improper file permissions and ownership (read Apache's error and suexec log file).

webhead 09-21-2004 09:12 PM

Hey, thanks guys.

I eventually ended up searching as many sites as possible and eventually figured out that it was all that windows control code bullshit. Sheesh, I'm not even running windows on the box, but its still managing to screw things up. :p

That dos2unix thing converts files to Unix type right? That would be most helpful, I really dont want to open all my CGI scripts with NEdit and save them as unix. x_x

misc 09-22-2004 01:56 AM

Lines in DOS/Windows text files end with CR/LF (carriage return + line feed) ASCII control characters, while Unix/Linux lines end with just LF. MacOS text files end with just CR. Few applications are aware of that. The others fails upon reading in lines and stripping off the line delimiters.


All times are GMT -5. The time now is 03:19 AM.