[Tutor] CGI Help

Adrian Maier am@fx.ro
Tue Apr 8 01:17:08 2003


Timothy M. Brauch (tbrauch@mindless.com) a scris :
> From: "Seabrook, Richard" <rhseabrook@aacc.edu>
> 
> From: Timothy M. Brauch [mailto:tbrauch@mindless.com]
> [ deleted ]
> 
> Here are the permissions I have set:
> 
> [root@linux0 simple]# dir
> total 28
> -rw-r-xr-x    1 root     root          978 Apr  7 23:05 simple2.py
> -rw-r--r--    1 root     root          676 Apr  7 22:48 simple.html
> -rw-r-xr-x    1 root     root          628 Apr  7 22:48 simple.py

The scripts are not executable for the owner. I'd suggest:
  chmod 755 *.py

(If i guess correctly, are you usually working as root?
It is better to create some account and log in as root 
only when you need to configure something)

> [root@linux0 simple]# ./simple2.py
> : bad interpreter: No such file or directory

The error probably refers to the interpreter specified in
the first line of your script. Are you sure that 
/usr/bin/python is valid?

Also, you may need to configure Apache (httpd.conf) before 
it will be able to execute your CGIs. 
I am not an expert in configuring Apache. I can only give you
two hints. 

There is an option (ExecCGI if i remember correctly) that 
needs to be set for each directory that contains CGIs.
(by default it isn't set because of security reasons)

Apache knows when to execute a cgi based on the file's
extension. The extension is cgi by default. You could
either:
a. rename your files to simple2.cgi or simple2.py.cgi
b. configure apache to treat .py files as CGIs.


Good luck.

-- 
Adrian Maier
(am@fx.ro, 0723.002.097)