Overview
I am having an incredible amount of difficulties getting cgi scripts to run. I am running Apache 2.0.54 on Fedora Core 4. I have already disabled SElinux. I am getting an "internal server error" error. I have succeeded in installing and configuring PHP, MySQL, phpMyAdmin, MediaWiki and phpBB2 (notice that they all use PHP and not CGI?) For the life of my I have been unable to get any perl scripts to work.
Background
I have created a user
intranet who's home directory is:
/home/intranet/. I have created a sub directory called
www and uploaded a cgi file named
test.cgi
The contents of the
/home/intranet/www/test.cgi are as follows:
Code:
#!/usr/bin/perl
##################################
##################################
### ###
### CGI IS NOT INSTALLED ###
### ###
### (or .cgi assoc. not set) ###
### ###
##################################
##################################
print "Content-type: text/html\n\n";
print "<html><head>";
print "<title>CGI Test File</title>";
print "</head>";
print "<body><font face=arial>Perl is installed on your server";
print "<br/>(and the .cgi extension is associated)</font>";
print "</body></html>";
I have run
chmod 755 test.cgi from the command line.
I have configured Apache as follows:
Code:
<VirtualHost 10.20.30.5:80>
ServerName intranet.modea.com
ServerAlias *.intranet.modea.com
AddHandler cgi-script .cgi
DocumentRoot /home/intranet/www
DirectoryIndex index.html index.htm
ServerSignature email
SuexecUserGroup intranet intranet
<Directory />
Options ExecCGI
AddHandler cgi-script .cgi
AllowOverride None
Allow from all
Order allow,deny
</Directory>
</VirtualHost>
Some of the above code is superfluous, however it should not conflict.
When I access the file over the web I get a standard "500 Internal Server Error" message.
The /var/httpd/error_log file shows the following:
Quote:
[Mon Dec 12 17:09:25 2005] [error] [client 10.20.30.109] Premature end of script headers: test.cgi
|
The /var/httpd/suexec.log show this:
Quote:
[2005-12-12 17:17:06]: uid: (501/intranet) gid: (501/501) cmd: t.cgi
[2005-12-12 17:17:06]: command not in docroot (/home/intranet/www/t.cgi)
|
(I'm not really sure what this log file is/says)
Other stuff
Here is the contents of my /home/intranet/www/ directory:
Quote:
-rw-r--r-- intranet intranet index.html
-rwxrwxrwx intranet intranet t.cgi
-rwxrwxrwx intranet intranet test.cgi
|
You will see that I actually chmod 777 the test.cgi files. The files were originally owned by
root because I created them at the command line while logged in as root. To change the user and group I ran the following while in
/home/intranet/:
Code:
chown -R intranet.intranet www
(I received an Internal Server Error message regardless of the file ownership)
My Thoughts
Even after significant research and "tweaking" I have been unsuccessful at getting this to work. I have seen many other people have issues running CGI using Fedora. Most of it seems to revolve around SElinux, which I disabled (by editing
/etc/selinux/config and setting "SELINUX=disabled" then rebooting)
I can serve up static .html pages without incident. I
think I have everything configured correctly but obviously I do not. I've been looking at this for so long that I cannot see the forest through the trees so any help would be appreciated.