Run 'python -V' to see the python version.
Run 'whereis python' to ensure it is /usr/bin/python
Step 1 : Create a file test.py in /home/username/public_html/cgi-bin with the content below :
#! /usr/bin/python
print "Content-type: text/html\n\n"
print "<html>Hello world!</html>"
Step 2 : Change ownership and file permissions
chown username:username /home/username/public_html/cgi-bin/test.py
chmod +x /home/username/public_html/cgi-bin/test.py
script should work using
http://domain.com/cgi-bin/test.pystep 3. to test script outside cgi-bin ,add the following content into /home/username/public_html/.htaccess file:
Options +ExecCGI
AddHandler cgi-script .py
copy script to /home/username/public_html
it will work using
http://domain.com/test.py