apache and cgi problems

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
hward
Forum Contributor
Posts: 107
Joined: Mon Apr 19, 2004 6:19 pm

apache and cgi problems

Post 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??
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post 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.
hward
Forum Contributor
Posts: 107
Joined: Mon Apr 19, 2004 6:19 pm

Post by hward »

owner is root in mine not sure on suexec how do I check that?
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post 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
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

please post your hello world script here
hward
Forum Contributor
Posts: 107
Joined: Mon Apr 19, 2004 6:19 pm

Post 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
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

check if /usr/bin/perl is correct path to you perl interpreter
hward
Forum Contributor
Posts: 107
Joined: Mon Apr 19, 2004 6:19 pm

Post by hward »

yes i checked and its there
i also have webmin installed and it is using the same path
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post 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.
Post Reply