python - run .py files on server - getting error 500 -



python - run .py files on server - getting error 500 -

i'm trying run simple python script in server (hostgator) , i'm getting error 500 when run in url.

this .py file: (in public_html folder) chmod:755

#!/usr/bin/env python print "content-type: text/html\n\n"; print "<html><head>"; print "<title>cgi test</title>"; print "</head><body>"; print "<p>test page using python</p>"; print "</body></html>";

and .htaccess: (in public_html folder)

addtype text/html py addhandler cgi-script .py

couple of things might wrong:

allowoverride fileinfo not set directory. 500 may indicate apache has issue "malformed" .htaccess

no executable bit on file:

$ chmod +x my.py

suexec gets in way. simple test is:

$ suexec=$(which suexec) $ mv ${suexec} ${suexec}.orig $ service httpd restart

in case of suexec there several things can do:

trace permissions , other items might preventing suexec normal operation disable suexec removing/renaming it's executable use scriptalias define location scripts (this seems sidestep suexec completely)

python .htaccess server

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -