1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Getting a test python script working

Discussion in 'Plesk for Linux - 8.x and Older' started by anjanesh, Mar 3, 2007.

  1. anjanesh

    anjanesh Guest

    0
     
    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
     
  2. theone

    theone Guest

    0
     
    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

    Remember to change the path to python binary location
     
  3. anjanesh

    anjanesh Guest

    0
     
    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
    
     
Loading...