• Debian 11 is approaching its end-of-life (vendor EOL date - August 31, 2026). Plesk Obsidian 18.0.80 will be the last release to support it.
    If you are running Plesk Obsidian on Debian 11, we recommend you upgrade those servers to Debian 12 using our dist-upgrade tool.
  • We plan to deprecate and remove the support for XML RPC protocol versions earlier than 1.6.9.1 in Plesk Obsidian 18.0.82. We strongly recommend that you update all existing integrations using earlier versions of the XML RPC protocol to comply with the version 1.6.9.1 specification.

Getting a test python script working

A

anjanesh

Guest
Hi

My client has a dedicated server having Plesk 7.5.4 with mod_python enabled.

I tried to run a test script
Code:
Print "hello"
but nothing shows up.
I had this in the htaccess
Code:
AddHandler mod_python .py
# AddHandler python-program .py # Tried this too but same result
PythonHandler mptest
PythonDebug On

How do I get a test python script running ?

Thanks
 
First you need to get the python binary location, su to root

which python

Then try the following script in a file and save it as Hello.py

#!/usr/bin/python
print "Content-type: text/html\n\n";
print "This is a test file of python";

Remember to change the path to python binary location
 
If python is available as a mod and not as CGI, why do we have to give the shebang line ?

Code:
from mod_python import apache

def handler(req):
      req.log_error('handler')
      req.content_type = 'text/html'
      req.send_http_header()
      req.write('Working<hr>')
      return apache.OK
 
Back
Top