[Tutor] Python isn't working with Apache (Windows)
mcgrath_ch at hotmail.com
Mon Jul 31 01:31:40 EDT 2017
I am trying to run a simple python web script in a browser with apache. I have apache installed and running perfectly. I installed Ruby and Perl using instructions from here and worked perfect. http://editrocket.com/articles/python_apache_windows.html
I did have to change my “shebang lines” for PERL and RUBY like these:
As you can see, I didn’t install them on C: drive. They worked.
I had Python 3.6 installed before and tried to test with these
All the pip files in the Script directory.
I also tried with #!Q:\LifeForce\Python36-32\python.exe. This one works worked from Window Command, but didn’t work from web browser like PERL and RUBY.
I tried downgrading to Python 2.7 and installed directly at C: drive and tested with
Nothing worked. I don’t have any idea anymore. Please help!
This is the simple code:
print ("Content-type: text/html")
print (" ")
print ("Hello Python.")
I am trying to run directly from Apache htdoc dir. Not from cgi dir. I think something is wrong with the shebang line.
This is the error output in the web browser:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at postmaster at localhost to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
This is what is shown in Apache’s error log:
[Mon Jul 31 01:06:54.266478 2017] [cgi:error] [pid 5156:tid 1688] [client 22.214.171.124:51723] malformed header from script 'test.py': Bad header:
[Mon Jul 31 01:06:54.270479 2017] [authz_core:error] [pid 5156:tid 1688] [client 126.96.36.199:51723] AH01630: client denied by server configuration: C:/Apache24
www.aawisdom.com<http://www.aawisdom.com> (716) 240-7786
More information about the Tutor