Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Aug 2004
Problem running python as cgi script
1. When I run "rpm -qa | grep python" I get following :
2. I have installed Python3.2 from source in /opt/python3/
3.Running "which python" gives me "/usr/bin/python"
4. In my Apcahe's httpd.conf file, i have made following changes :
i) AddHandler cgi-script .cgi .py .c
ii) ScriptAlias /cgi-bin/ "/home/asn2012/public_html/cgi-bin/"
iii) <Directory "/home/w34admin/public_html/cgi-bin/">
Allow from all
iv) <Directory /home/*/public_html/cgi-bin>
5. There is not issue of uploading file in ASCII mode, since I have created the script on the server itself using vim.
6. The file I want to run has got "chmod a+x filename"
Now when I place the file demo.py within /home/asn2012/public_html/cgi-bin/ and point my browser to the file, it gives "Internal Server Error".
When I tail the log file, it gives me
[Fri Apr 20 00:43:02 2012] [notice] Digest: generating secret for digest authentication ...
[Fri Apr 20 00:43:02 2012] [notice] Digest: done
[Fri Apr 20 00:43:02 2012] [warn] No JkLogFile defined in httpd.conf. Using default /etc/httpd/logs/mod_jk.log
[Fri Apr 20 00:43:02 2012] [warn] No JkShmFile defined in httpd.conf. Using default /etc/httpd/logs/jk-runtime-status
[Fri Apr 20 00:43:02 2012] [notice] mod_python: Creating 4 session mutexes based on 50 max processes and 0 max threads.
[Fri Apr 20 00:43:02 2012] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations
Please help me out to successfully run the script. Thanks in advance.
- Join Date
- May 2011
some things to check:
1. do you have the path to your python interpreter at the top of your demo.py script? e.g.:
print "Content-Type: text/html" print "" print "Hello World!";
4. does the user that is running apache have read rights to the directory where the CGI script lives (e.g., /home/asn2012)?
5. are you sure you are looking at the right apache error log file? you should be seeing something. check also the access_log.
also, i don't think you need the <Directory "/home/w34admin/public_html/cgi-bin/"> line in your httpd.conf file. at least for what you are trying to do here.