Difference between revisions of "Python"

From Hostek.com Wiki
Jump to: navigation, search
(Created page with "While the Hostek support team does not provide detailed support for Python, Python does come installed on cPanel account. To test a Python script on your cPanel account, do t...")
 
(No difference)

Latest revision as of 18:40, 20 March 2017

While the Hostek support team does not provide detailed support for Python, Python does come installed on cPanel account.

To test a Python script on your cPanel account, do the following:

Create a python script file example.py with the following contents:

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

Make sure the file is owned by the user and has execute permissions:

chown user.user example.py
chmod +x example.py

Add handler for python to the .htaccess file:

Options +ExecCGI
AddHandler cgi-script .py

Now you should be able to run domain.com/example.py