Python

From Hostek.com Wiki
Revision as of 18:40, 20 March 2017 by Briana (Talk | contribs) (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...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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