1
I've got my installation of the newest XAMPP version (w/PHP 7.2.2) setup and running apache just fine on my Windows 10 laptop for my PHP programming class. I was able to get CGI working to run .py files correctly in the browser window, using the option +ExecCGI and adding .py to the AddHandler line in the /XAMPP/apache/conf/httpd.conf.
Normally the first two lines need to look like this with CGI in order for the .py file to run correctly:
#!C:/Python/Python36_x86/python.exe
print("Content-Type: text/html\n")
However, after reading Apache2.4 documentation for ScriptInterpreterSource: https://httpd.apache.org/docs/2.4/mod/core.html#scriptinterpretersource
I added the correct registry key mentioned in the documentation along with the line:
ScriptInterpreterSource Registry-Strict
to my /XAMPP/apache/conf/httpd.conf
and was able to run my Python script without those first two lines. However, it still requires an extra print() statement on the first line (or print('\n') ).
===========================================================================
MY QUESTION:
Is there any way at all to get around needing the print/newline statement on the first line of the Python script?
Thank you for your answer, but I am not allowed to mark it or anything since I am a new member with <15 rep. – Maleko48 – 2018-03-13T17:27:48.580
No worries. You're welcome. =) – Anaksunaman – 2018-03-13T17:43:52.030