Click to See Complete Forum and Search --> : ANOTHER Apache problem: I can no longer run CGI scripts


Carl Pender
03-11-2003, 12:53 PM
I have an apache web server up and running. I can no longer run my CGI scripts that I have saved. The Apache server is supossedly running when I use the command:

/usr/local/apache/bin/apachectl start

I get no errors, but when I try to run my CGI scripts by typing into the URL bar:

http://my_ip_address/usr/local/apache/cgi-bin/test.cgi


I get a web page saying:

NOT FOUND
The requested URL /usr/local/apache/cgi-bin/register.html was not found on this server.

This is really beginning to annot me because I can't see what I'm doing wrong. i'm doing exactly what I did before but it wont work like it used to and I've wasted a lot of time trying to resolve it.

Could anyone please give me ideas of what to try or even to tell me how to start the Apache server from scratch just incase I've edited something that I shouldn't have.

Thanks!

chrism01
03-11-2003, 01:17 PM
Start by seeing if its running. Check
ps -ef|grep http
should get about 6 replies 1 parent, 5 kids.
if on RH, try
service httpd restart
check /var/log/messages when doing this. eg
tail -f /var/log/messages
If its running, check the apache logs to get more details; conventionally access_log and error_log files. Depneding on distro/version should be
/etc/httpd/log(s)
/var/log.....
HTH

EscapeCharacter
03-11-2003, 01:29 PM
Originally posted by Carl Pender


http://my_ip_address/usr/local/apache/cgi-bin/test.cgi



Thanks! [/B]

i dont know your setup but im pretty sure the address is wrong. have you tried http://your_ip/cgi-bin/test.cgi?

Carl Pender
03-11-2003, 02:45 PM
Yeah I tried that as well but still the same problem. I've wasted nearly a whole day at this. It's very frustrating.

Thanks anyway guys!

bwkaz
03-11-2003, 03:47 PM
In your httpd.conf, is there a ScriptAlias set up for /cgi-bin/? Is there a Directory set up for /usr/share/httpd/cgi-bin (if that's where the ScriptAlias is looking)?

When you type in the whole path to the cgi, Apache adds whatever DocumentRoot is set to, to the front of it, which is why the full path is probably wrong. Apache also looks for Alias (and ScriptAlias) lines that match any part of the resulting URL, and replaces the matching part with its alias -- so for example, this alias:

ScriptAlias /cgi-bin/ "/usr/share/httpd/cgi-bin/" makes any URL that has cgi-bin in it (like the aforementioned http://your-server/cgi-bin/test.cgi) get replaced with /usr/share/httpd/cgi-bin/, so that the file that Apache looks for is /usr/share/httpd/cgi-bin/test.cgi on the local system.

It's probably something with the ScriptAlias and/or where the test.cgi file got put.

Carl Pender
03-12-2003, 07:40 AM
The thing is that there is no directory /usr/share/httpd/..... on my Linux system. I'm using Suse 7.3. My fCGI files are saved in /usr/local/apache/cgi-bin/. My scripts were running perfectly two days ago when I used the same URL, namely

http://157.190.66.81/usr/local/apache/cgi-bin/test.cgi

but they no longer work. I have also tried

http://157.190.66.81/cgi-bin/test.cgi

but that doesn't work either. I would post a copy of my httpd.conf file but it's too big but if there are any specific parts of the file that you think might help, please let me know

Thanks!

bwkaz
03-12-2003, 10:12 AM
The ScriptAlias line.

And the Directory section whose directory is the same as the target of the ScriptAlias.

Carl Pender
03-12-2003, 10:35 AM
OK here's a copy of the Script Alias part and the Directory

# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/"

<IfModule mod_cgid.c>
#
# Additional to mod_cgid.c settings, mod_cgid has Scriptsock <path>
# for setting UNIX socket for communicating with cgid.
#
#Scriptsock logs/cgisock
</IfModule>

#
# "/usr/local/apache/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/usr/local/apache/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

I hope this is of some help

bwkaz
03-12-2003, 02:21 PM
OK, http://your_IP_or_hostname/cgi-bin/test.cgi should have worked.

What error were you getting?

Is the test.cgi file set as executable by the Apache process (which will be running either as "nobody" or as "www")?

Carl Pender
03-13-2003, 11:07 AM
The error I was getting was:

NOT FOUND
The requested URL /usr/local/apache/cgi-bin/register.html was not found on this server.

or else

NOT FOUND
The requested URL /cgi-bin/register.html was not found on this server.

All my CGI scripts are executable. They were running a few days prior. That's what makes this so FRUSTRATING. Why is this happening to me. i could really do without it right now. :mad: