logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Other Software View previous topic :: View next topic
Reply to topic   Topic: Problem running python as CGI script on CentOS5
Author
asn2012



Joined: 20 Apr 2012
Posts: 1
Location: India

PostPosted: Fri 20 Apr '12 12:26    Post subject: Problem running python as CGI script on CentOS5 Reply with quote

Hi, I have a virtual dedicated server. And I am trying to run Python as CGI script.
1. When I run "rpm -qa | grep python" I get following :
audit-libs-python-1.7.18-2.el5
mod_python-3.2.8-3.1
python-elementtree-1.2.6-5
python-iniparse-0.2.3-4.el5
python-urlgrabber-3.1.0-6.el5
python-2.4.3-44.el5
libselinux-python-1.33.4-5.7.el5
libxml2-python-2.6.26-2.1.2.8.el5_5.1
rpm-python-4.4.2.3-22.el5
python-sqlite-1.1.7-1.2.1
python-libs-2.4.3-44.el5

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/">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
iv) <Directory /home/*/public_html/cgi-bin>
Options ExecCGI
SetHandler cgi-script
</Directory>

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.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7298
Location: Germany, Next to Hamburg

PostPosted: Sat 23 Jun '12 14:42    Post subject: Reply with quote

Did you define the shebang line?
Back to top


Reply to topic   Topic: Problem running python as CGI script on CentOS5 View previous topic :: View next topic
Post new topic   Forum Index -> Other Software