[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: cgi-bin



Robert Harris wrote:
Mark Grieveson wrote:
Robert Harris wrote:
Mark Grieveson wrote:
Hello.  cgi-bin files are not working on my webserver.  I use apache2,
on Etch.  Specifically, I'm trying to get htsearch, of the search
program htdig, to work on my site that I serve.  It worked with Sarge,
but does not work with Etch.  The file is at /usr/lib/cgi-bin/htsearch,
and the connection is http://www.opseu540.info/cgi-bin/htsearch
(www.opseu540.info being the site I serve). Mark

Check your logs (in /var/log/apache2 on my system). Most likely you have
a permissions problem - make sure that your apache user (www-data on my
system) is allowed to execute your cgi scripts.

Robert


But gnome-system-tools only lists "real" users; apache is generally run
by a special user (www-data) - traditionally root did it but a special
user is more secure. if you list /etc/passwd from a console (more
/etc/passwd), you will get a list containing the special users as well.
I checked the permissions on /usr/lib/cgi-bin/, and discovered they are
1200755 (number view), drwxr-xr-x (text view).  The file htsearch's
permissions are 1200755 (number view) and -rwxr-xr-x (text view).
So, from here I'm not sure what to do, but I suspect that I need to
install a package or two.
what matters is the permissions on the scripts themselves which should
be in the /usr/lib/cgi-bin directory.
Coincidentally, I did test htsearch within the terminal, and it works
there (see below where I search for "test"):

mark@debian:/usr/lib/cgi-bin$ ./htsearch
Enter value for words: test
Content-type: text/html

Enter value for format:

<html>
<head>
<title>Search results for 'test'</title>
...........etc

It spits out the rest of the code correctly, for the page that should
appear when this command is accessed via the website with the apache2
webserver.

The /var/log/apache2/error.log simply states "File does not exist:
/home/mark/public_html/cgi-bin".

Something is telling apache to look in the wrong place for scripts.
Don't run apache as "mark"; instead start it up from root with:

/etc/init.d/apache2 start

then it may well look in the right place.

If it doesn't, then try and understand your configuration files in
/etc/apache2

Robert

Thanks for the suggestions. Okay, from the /etc/passwd file, I discovered this about the www-data user:

debian:/home/mark# cat /etc/passwd
(other stuff edited out)
www-data:x:33:33:www-data:/var/www:/bin/sh

As root, I ran the command "/etc/init.d/apache2 start", but still no change. I fished around, and I did find a file entitled cgi.load, in /etc/apache2/modules-enabled directory, and this file reads: "LoadModule cgi_module /usr/lib/apache2/modules/mod_cgi.so". The file mod_cgi.so does exist in the /usr/lib/apache2/modules file.

The cgi file is the htsearch one, in /usr/lib/cgi-bin/htsearch, and its permissions are 1200755 (number view) and -rwxr-xr-x (text view).

Alas, I'm still stumped.

Mark



Reply to: