Mar-19-2023, 02:01 PM
I am starting to explore Python. I have downloaded the latest version of Python. Installed the same for all users and have tested it too
AddHandler cgi-script .py
ScriptInterpreterSource Registry-Strict
index.py, default.py and home.py have been added as some of the default documents.
Now wrote a quick test .py script as below
print ("Hello World") and it worked fine on commandline.
Now running the same through XAMPP triggers an Internal Server Error and in the logs shows a message like
[Sun Mar 19 19:36:57.115244 2023] [win32:error] [pid 4872:tid 1896] [client ::1:57020] AH02102: C:/xampp/htdocs/index.py is not executable; ensure interpreted scripts have "#!" or "'!" first line
[Sun Mar 19 19:36:57.115244 2023] [cgi:error] [pid 4872:tid 1896] (9)Bad file descriptor: [client ::1:57020] AH01222: don't know how to spawn child process: C:/xampp/htdocs/index.py
Python is in the environmental variable and can be invoked from anywhere (for all users)
Output:Python 3.11.2
Now I have also configured Python to my httpd.conf of XAMPP Apache by adding these lines.AddHandler cgi-script .py
ScriptInterpreterSource Registry-Strict
index.py, default.py and home.py have been added as some of the default documents.
Now wrote a quick test .py script as below
print ("Hello World") and it worked fine on commandline.
Now running the same through XAMPP triggers an Internal Server Error and in the logs shows a message like
[Sun Mar 19 19:36:57.115244 2023] [win32:error] [pid 4872:tid 1896] [client ::1:57020] AH02102: C:/xampp/htdocs/index.py is not executable; ensure interpreted scripts have "#!" or "'!" first line
[Sun Mar 19 19:36:57.115244 2023] [cgi:error] [pid 4872:tid 1896] (9)Bad file descriptor: [client ::1:57020] AH01222: don't know how to spawn child process: C:/xampp/htdocs/index.py
Python is in the environmental variable and can be invoked from anywhere (for all users)