Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't get any CGI scripts to run... 2

Status
Not open for further replies.

twics

IS-IT--Management
Apr 27, 2004
6
CA
Okay, I am running Mandrake Linux 8.0 with Apache-AdvancedExtranetServer/1.3.23 Server. I cannot get a single CGI script to run. Here are the related directives on the Apache server:

[blue][tt]User apache /etc/httpd/conf/commonhttpd.conf (3)
Group apache /etc/httpd/conf/commonhttpd.conf (4)

<IfModule mod_alias> /etc/httpd/conf/commonhttpd.conf (193)
Alias /icons/ /var/ /etc/httpd/conf/commonhttpd.conf (200)
Alias /doc /usr/share/doc /etc/httpd/conf/commonhttpd.conf (201)
ScriptAlias /cgi-bin/ /var/ /etc/httpd/conf/commonhttpd.conf (212)
ScriptAlias /protected-cgi-bin/ /var/ /etc/httpd/conf/commonhttpd.conf (213)
</IfModule> /etc/httpd/conf/commonhttpd.conf (225)

AddHandler cgi-script .cgi /etc/httpd/conf/commonhttpd.conf (433)[/tt][/blue]


here are the permissions for /var/[blue][tt]
drwxr-xr-x 2 root root 4096 Apr 27 08:27 cgi-bin/
drwxr-xr-x 4 root root 4096 Apr 8 19:22 html/
drwxr-xr-x 3 root root 4096 Apr 8 19:15 icons/
drwxr-xr-x 2 root root 4096 Apr 8 19:16 perl/[/tt][/blue]

Here is the permissions for the script I am trying to run:

[blue][tt]-rwxr-xr-x 1 root root 268 Mar 5 2002 printenv.cgi*[/tt][/blue]

When I try to view in a browser I receive:

[red][tt]403 forbidden

You don't have permission to access /cgi-bin/printenv.cgi on this server.

Apache-AdvancedExtranetServer/1.3.23 Server at Port 80 [/tt][/red]

If I go to the Mandrake server and attempt I get the same problem.

I need a quick solution to this problem. Please send me any (Linux based) ideas possible on this one. My client is waiting for this functionality to be up and running ASAP.
 
Normal pages serve up fine. As far as the error log goes. Here is what it says:

[tt][Tue Apr 27 08:58:11 2004] [error] [client 64.56.132.237] client denied by server configuration: /var/www/cgi-bin/printenv.cgi[/tt]
 
Some questions:
1 Do you have a <Directory> directive in your apache conf file for the cgi-bin?
2 Do you have a .htaccess file in your cgi-bin directory?
3 Does your access log have more info on the problem?
4 Are you using suexec?

 
Here is the Directory section:

[tt]
<Directory /var/ AllowOverride All /etc/httpd/conf/commonhttpd.conf (670)
Options ExecCGI /etc/httpd/conf/commonhttpd.conf (671)
</Directory>[/tt]

There is no .htaccess file in the cgi-bin directory.

Not sure about the suexec part. How would I tell?

access_log:

[tt] <server IP> - - [27/Apr/2004:14:24:05 +0100] "GET /cgi-bin/printenv.cgi HTTP/1.1" 403 322 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"[/tt]
 
I'm not really seeing anything that could be causing the problem yet. From what I understand the ScriptAlias being set correctly (which it is) and having the permissions on your directory and files set correctly (which they are) should be all you need.

One minor note, though it may be correct as it is, is that you don't have a + before your "ExecCGI" as shown here:
But like I said, I don't think this should matter.

Did you have to manually add the ScriptAlias to your conf file and if so, did you restart Apache after you added it?

I read more closely on suexec and it looks like the error you're getting is not because of it (suexec would give an "Internal Server Error"... see here:

If you can't get the help you need in this forum try asking in the Apache forum ( forum65 )
 
you did set up 2 directories in your htpd.conf or whatever its called on linux?

ScriptAlias /cgi-bin/ "/var/ ScriptAlias /protected-cgi-bin/ "/var/

<Directory "/var/ AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

<Directory "/var/ AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
 
Here is what ended up resolving the problem:

[blue][tt]<Directory /var/ AllowOverride None /etc/httpd/conf/commonhttpd.conf (670)
Options ExecCGI /etc/httpd/conf/commonhttpd.conf (671)
Options None /etc/httpd/conf/commonhttpd.conf (672)
order deny,allow /etc/httpd/conf/commonhttpd.conf (673)
allow from all /etc/httpd/conf/commonhttpd.conf (674)
</Directory>[/tt][/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top