Difficulty configuring web server for Python

Thomas Wouters thomas at xs4all.nl
Mon Aug 16 11:15:06 EDT 1999


On Mon, Aug 16, 1999 at 02:44:56PM +0000, mbf2y at my-deja.com wrote:

> I built a simple CGI script and kept getting error 500, so I simplified
> to the below script:

> #!/usr/home/campusch/usr/local/bin/python

Does your webserver do something like chroot() ? If so, is this the correct
path according to the webserver ?

> print "Content-type: text/html"
> print
> print "<HTML><BODY><H1>Hello World!</H1></BODY></HTML>"
> print

> 4) python itself has been chmod ugo+x so the web server process should
> be able to run it.

And all the directories below it are chmod <webserver>+x as well ?

> 5) This script has been chmod ugo+x so the web server process should be
> able to run it.

Has it also been set readable ? it needs to be readable for the webserver to
start python to interpret.

> [Sun Aug 15 21:59:31 1999] [error] (2)No such file or directory: exec of
> /usr/local/etc/httpd/cgi-bin/simp.py failed
> [Sun Aug 15 21:59:31 1999] [error] Premature end of script headers:
> /usr/local/etc/httpd/cgi-bin/simp.py

> While the "no such file or directory" threw me, this is not a file not
> found error... when I tried to run a script that really wasn't there, I
> got:

The 'no such file' probably refers to the script interpreter, not the script
itself... Is the script in unix text format, or DOS ? 'DOS text format'
means line endings are marked using '\r\n', UNIX uses just '\n's. Having the
file in DOS text would mean the webserver is looking for
'/usr/home/campusch/usr/local/bin/python^M'. You either need to run dos2unix
on those files (or dos2bsd as it's called under BSDI) or add a (sym)link
from python to python^M. (To give a hint... using the tcsh shell you do it
with

ln -s python python<control-v control-j>

in the /usr/home/campusch/usr/local/bin directory.

G'luck :)

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list