I'm tryning out CGI-scripts the very first time but with no success. I've read many lessons and adopted may threads in various forums but I am unable to have great results. I'm utilizing a appache web server on the Fedora 10 machine. I usually have trouble with

[Wed Oct 21 20:47:36 2009] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:httpd_t:s0
[Wed Oct 21 20:47:36 2009] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Oct 21 20:47:36 2009] [notice] Digest: generating secret for digest authentication ...
[Wed Oct 21 20:47:36 2009] [notice] Digest: done
[Wed Oct 21 20:47:36 2009] [notice] Apache/2.2.11 (Unix) DAV/2 PHP/5.2.9 mod_ssl/2.2.11 OpenSSL/0.9.8g configured -- resuming normal operations

I want help. This is exactly what my atmosphere appears like.

uname -a
Linux localhost.localdomain 2.6.27.5-117.fc10.i686 #1 SMP Tue Nov 18 12:19:59 EST 2008 i686 i686 i386 GNU/Linux

ls -l /var/www/cgi-bin/
total 36
-rwxrwxrwx 1 root root   106 2009-10-21 18:29 index.html
-rwxr-xr-x 1 root root 11089 2009-02-24 20:11 squidGuard.cgi
-rwxr-xr-x 1 root root  5720 2009-02-24 20:11 squidGuard-simple.cgi
-rwxr-xr-x 1 root root  5945 2009-02-24 20:11 squidGuard-simple-de.cgi
-rwxrwxrwx 1 root root   110 2009-10-21 17:38 test.cgi

apachectl -v
Server version: Apache/2.2.11 (Unix)
Server built:   Mar  6 2009 09:12:25

perl -version
This is perl, v5.10.0 built for i386-linux-thread-multi
Copyright 1987-2007, Larry Wall

My script

cat test.cgi
#!/usr/bin/perl
print "Content-Type: text/html\n\n";
print "Hello, world!\n";

The mistake message I gen after i attempt to access the site server "http://192.168.50.29/cgi-bin/test.cgi" appears like this:

[Wed Oct 21 21:00:27 2009] [error] [client 192.168.50.69] (13)Permission denied: access to /cgi-bin/test.cgi denied

I've added the road:

ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

to /etc/httpd/conf/httpd.conf

I simply can't have great results. Can anybody assist me to?

Look at your os permissions for test.cgi and make certain the consumer or group you're using to operate your apache it's read access.

EDIT - The issue is with permissions, although not with read permissions, when you are using SELinux, you have to be worried about your file context. Take a look thread at fedora forums, it describes a number of choices to solve your condition.

1.FIRST Look Into The HTTPD.CONF FILE.Set the script directory the following within the httpd.conf.
Here you'd have to make certain you find the correct httpd.conf file.For instance, during my Debian, the default httpd.conf is /etc/apache2/sites-avaialbe/default.


<Directory "dir_title">

    Options All

    AllowOverride All

    Order allow,deny

    Allow all

<Directory>

OR you can only use the default /cgi-bin folder.

2.Set the execute permission for that test script.


chmod +x script_title