list at joreybump.com
Fri Dec 9 14:17:57 EST 2005
chase3 at llnl.gov wrote: > As a first step in moving a CGI script to mod_python, I wrapped the > script in a handler. This seems to work and the database does > receive the data. It looks like things should be ok. However, > I am getting a 500 Internal Server Error back that I have not been > able to figure out, as there were no other clues in the error_log. > In fact, putting an log message shows execution is successful: > > ... > # Close the connection > db.close() > apache.log_error ( "success", apache.APLOG_ERR ) > return apache.OK > else: > apache.log_error ( "Failed!", apache.APLOG_ERR ) > return apache.SERVER_RETURN > > I get "success" in the log file. if...? > I put this mod_python script in the cgi-bin because when it was > in htdocs, I ran into 401 Authorization Required problems. First, don't put mod_python scripts in cgi-bin. They are not CGI. > I should mention that I am not communicating to the server with > a URL in a browser, but through a utility that uses CURL and SSL to > do an HTTPS post, so user authentication is not possible. If you want unrestricted access to a file, put it in a directory without restrictions or override the restrictions in your configuration. > When the mod_python script is in cgi-bin, user authentication is > not required. Perhaps, but it will cause problems in some configurations. > The software uses a digital signature for authentication. > > <Directory "/etc/httpd/cgi-bin/tracker"> > AddHandler python-program .py > PythonHandler mod_python.publisher > PythonDebug On > </Directory> Create a separate directory outside of your document root. Use the Alias directive to make it accessible. Revise your Directory container above to refer to the new directory. Use SetHandler instead of AddHandler, and only put .py files in it. Put other resources like images, css, etc. in your normal document root. Although switching to SetHandler is optional, there are a lot of benefits. > Any ideas on how to locate the server error? Your apache error log is the best source. But your current configuration is a little screwy, so try the steps I've described.