[CentOS] Centos 4 and cgiemail

Dave Cross davorg at gmail.com
Sat Nov 20 18:24:18 UTC 2010


Apologies for not replying sooner. This mailing list goes into a "read
when you're not too busy" folder :-/

On 18 November 2010 17:08, Todd Cary <todd at aristesoftware.com> wrote:
>
> On 11/12/2010 10:15 AM, Dave Cross wrote:
>
> It all depends very much on how the web server is configured. Do you
> know if the web server is configured to run CGI programs? Do you have
> access to the Apache configuration files? (Actually, is the server
> running Apache?)
>
> What value have you given the "action" attribute on the form element?
> You say that the CGI program is in the cgi-bin directory - was that
> directory there before, or did you create it yourself? Are there any
> other cgi-bin directories in the web area on the server?
>
> <<< Do you know if the web server is configured to run CGI programs?  >>>
> The server is in my office running Centos 4, however I am not sure how to
> check to see if it is configured to run CGI.

By "web server", I meant the Apache software, not the operating system.

To see if your web server is configured to run CGI, you need to look
in your Apache configuration file (/etc/httpd/httpd.conf) and look for
lines that reference "cgi". You might well find lines like this
scattered through the file:

  LoadModule cgi_module modules/mod_cgi.so

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

  AddHandler cgi-script .cgi

> <<< Do you have access to the Apache configuration files? (Actually, is the
> server running Apache?) >>>
> Yes, it is running Apache and I have complete access.

That's good. The situation isn't impodsible then :-)

> <<< What value have you given the "action" attribute on the form element?
>>>>
> <form
> action="http://www.toddcary.com/srjc_CIS50_11B/lesson_6/cgi-bin/cgiecho/template.txt"
> method="post">
>
> The template.txt file is at
> http://www.toddcary.com/srjc_CIS50_11B/lesson_6/template.txt
>
> The cgi is at
> http://www.toddcary.com/srjc_CIS50_11B/lesson_6/cgi-bin/cgiecho

This puzzles me. The action on a form attribute needs to point to an
executable file (or something that the web server can resolved to an
executable of some kind). Setting it to the path to a text file is
never going to work.

> This is the error:
> The requested URL /srjc_CIS50_11B/lesson_6/cgi-bin/cgiecho/template.txt was
> not found on this server

Ok, that means that your web server isn't mapping URLs to the
filesystem in the way that you think. If you put a test file in
srjc_CIS50_11B/lesson_6, can you see it in a browser?

> <<< You say that the CGI program is in the cgi-bin directory - was that
> directory there before, or did you create it yourself? >>>
> I created the directory as part of the project.

Ok, you can't do that. Just creating a directory called cgi-bin
doesn't automatically create a CGI directory. The web server needs to
be configured correctly to recognise that it's a CGI directory.

> <<< Are there any other cgi-bin directories in the web area on the server?
>>>>
> No other cgi-bin directories in the Web area.

Which perhaps indicates that the web server isn't expected to be used
for CGI programs. Who configured the server for you? Can you go to
them for help configuring the server to support CGI?

The standard Centos 5 Apache configuration puts the web root at
/var/www/html and the cgi-bin at /var/www/cgi-bin. If your server
isn't configured like that then it's hard to be much help without
seeing far more detail about the configuration.

Rather than posting a complete beginners course to CGI to the mailing
list, can I point you to a servers of tutorials that I wrote several
years ago.

  http://mag-sol.com/articles/cgi1.html
  http://mag-sol.com/articles/cgi2.html
  http://mag-sol.com/articles/cgi3.html

Let me know if I can be any more help.

Cheers,

Dave...

-- 
Dave Cross :: dave at dave.org.uk
http://dave.org.uk/
@davorg



More information about the CentOS mailing list