Cgi scripts in apache not working
Paul Boddie
paul at boddie.org.uk
Thu Jul 28 18:26:36 EDT 2005
David wrote:
>
> httpd.conf:
>
> <Directory "/home/*/public_html/cgi/"> << Tried it with "" and no ""
> Options ExecCGI << Tried with "Options +ExecCGI"
> AddHandler cgi-script .cgi .py << Tried with "SetHandler
> cgi-script", but still no go
> </Directory>
>
>
> error_log:
>
> [Thu Jul 28 11:44:53 2005] [error] [client xxx.xxx.xxx.xxx] Premature
> end of script headers: test2.py
I assume that you have a UserDir directive elsewhere in your
configuration; otherwise, what you've written probably won't be enough.
See this guide for the full details:
http://httpd.apache.org/docs/2.0/howto/public_html.html
I typically find that using the ScriptAlias directive does what I want,
although I don't work with user directories myself. Here's an example:
ScriptAlias /cgi/ "/home/paul/some_directory/"
I imagine that the ScriptAliasMatch directive would also be able to do
the home directory matching that you are doing in your configuration
file. See the documentation for both directives here:
http://httpd.apache.org/docs/2.0/mod/mod_alias.html#scriptalias
Apart from using ScriptAlias, I don't usually do anything more than
check the ownership/permissions on the CGI directory and the script.
Naturally, the PYTHONPATH (or sys.path) needs to be configured to find
non-installed modules and packages, but such things are beyond this
particular problem.
Paul
More information about the Python-list
mailing list