0

I have been trying to start using Python with Apache and have followed all of the tutorials that I could find online. There are others with this problem but I have been unable to solve it for myself. Apache runs Perl files successfully but not Python files. Instead I get the error above - End of script output before headers. I am pointing to the correct path to python.exe and have tried countless variations of the simple code that I am trying to get to run. Furthermore I have altered the httpd.conf file to add AddHandler cgi-script .cgi .pl .asp .py and Options Indexes FollowSymLinks Includes ExecCGI. The simple code that I am trying to get to run is

#!"C:\Python34\python.exe"  

print "Content-Type: text/html\n\n";  

print  

print "OK";  

Any help would be greatly appreciated. Remember that a perl script like the one below, works perfectly fine.

#!"C:\xampp\perl\bin\perl.exe"  

print "Content-Type: text/html\n\n";  

print "OK";  

Thank you so much for any help that you can give. It is greatly appreciated. Also I am using Windows and Xampp

1 Answer 1

1

You seem to be using Python 3.4 in which print is a function and not a statement. Try changing your print statements to print() function calls.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.