1- Start creating a test script, name the file "mytest.py" for example, containing this code:

#! /usr/bin/python
print "Content-type: text/html\n\n"
print "<html>Hello world!</html>"

2- Create the file mytest.py in /home/username/public_html/cgi-bin directory (replace "username" with your cPanel username)

3- Correct the file permission, you can do this with your FTP program or through SSH (if you have access):

The ssh comand is:

chmod +x mytest.py

At this point, the script should work using http://yourdomain.com/cgi-bin/mytest.py

If you would like the script to run outside the cgi-bin directory, place the following content into the .htaccess file in your public_html directory:

Options +ExecCGI
AddHandler cgi-script .py

You could then copy the file mytests.py to /home/username/public_html and have it work there as well so you can run it accessing to http://yourdomain.com/mytest.py

Was this answer helpful? 6 Users Found This Useful (588 Votes)