Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have the PHP handler working perfectly fine, but one of my friends would like to use Python as well. I have Python installed on my server at /usr/bin/python2 (for Python2) as well as /usr/bin/python -> /usr/bin/python3 (for Python3). He prefers Python2 so I was just going to have .py files use the Python2 binary. Anyways, after setting it up in the Apache config and suPHP config, it keeps giving me the following error:

SecurityException in Application.cpp:511: Unknown Interpreter: python:/usr/bin/python2
Premature end of script headers: test.py

The relevant lines from httpd.conf:

AddType text/x-python .py
suPHP_AddHandler text/x-python .py

and under the [handlers] section of suphp.conf:

text/x-python="python:/usr/bin/python2"

What do I need to do in order to get Python working via suPHP, if it's possible?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

suPHP is specifically designed for PHP; you'll need to use suEXEC, which is part of Apache and simple to use. As long as the python scripts are normally executable as CGIs, it should work fine.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.