Page 1 of 1
apache and cgi problems
Posted: Tue Jun 08, 2004 8:01 pm
by hward
hi i have a fresh fedora core 1 install and apache is running fine, I put a hello world cgi in the cgi-bin and I cant get it to do anything i checked the error logs and it says Premature end of script headers
checked exe permisions on files and folders
anyone have any suggestions??
Posted: Tue Jun 08, 2004 9:55 pm
by redmonkey
I don't know much about fedora however, have you checked the usual suspects...
Has the cgi-bin been configured correctly within the apache config file.
Have you specified the correct path to the interpretor as the fist line of your script.
Have you checked the permissions of the script file you are trying to run e.g. it is executable.
If I remember correctly, the standard fedora apache install runs with suexec. If that is the case, apache will not run scripts that are group or world writeable. Also, apache will not run scripts that are owned by root (although I think the behaviour is that apache will still try to run but with whatever user apache is running as.
Posted: Tue Jun 08, 2004 10:22 pm
by hward
owner is root in mine not sure on suexec how do I check that?
Posted: Tue Jun 08, 2004 10:43 pm
by redmonkey
I would change the owner/group of the scripts to a standard user.
suexec should show up in your error log something like "suEXEC mechanism enabled" and probably a path to the executable. If it's not mentioned in the logs you should probably just double check for the file, you should be able to search the file system for suexec (it should be in apache's sbin directory (sorry I don't know where that is on fedora)).
If apache is installed at /usr/local/apache then it will be in /usr/local/apache/sbin other possibles are /sbin or /usr/sbin
Posted: Tue Jun 08, 2004 10:58 pm
by Weirdan
please post your hello world script here
Posted: Tue Jun 08, 2004 11:29 pm
by hward
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print <<"EOF";
<HTML>
<HEAD>
<TITLE>Hello, world!</TITLE>
</HEAD>
<BODY>
<H1>Hello, world!</H1>
</BODY>
</HTML>
EOF
Posted: Tue Jun 08, 2004 11:35 pm
by Weirdan
check if /usr/bin/perl is correct path to you perl interpreter
Posted: Tue Jun 08, 2004 11:36 pm
by hward
yes i checked and its there
i also have webmin installed and it is using the same path
Posted: Wed Jun 09, 2004 11:53 am
by redmonkey
I don't see anything wrong with the script, I can only presume that it must be some config problem. Not knowing much about fedora, I can't really suggest anyhting else.