As per the discussion, there were multiple problems here, which were solved by examining the error.log
written by apache and then making appropriate changes.
The first error was:
[Tue Nov 20 17:49:06.593901 2018] [cgi:error] [pid 47854] [client
::1:50462] AH01215: (13)Permission denied: exec of
'/Applications/XAMPP/xamppfiles/htdocs/myurl.py' failed:
/Applications/XAMPP/xamppfiles/htdocs/myurl.py [Tue Nov 20
17:49:06.595547 2018] [cgi:error] [pid 47854] [client ::1:50462] End
of script output before headers: myurl.py
The relevant part here is:
(13)Permission denied: exec of '/Applications/XAMPP/xamppfiles/htdocs/myurl.py' failed
Permissions needed to be set on the .py
file being executed to allow the user running the apache process to execute the script. This was done using chmod
.
Then, another error was presented:
[Tue Nov 20 17:59:04.720816 2018] [cgi:error] [pid 48715] [client
::1:50555] AH01215: python3: No such file or directory:
/Applications/XAMPP/xamppfiles/htdocs/myurl.py [Tue Nov 20
17:59:04.720884 2018] [cgi:error] [pid 48715] [client ::1:50555] End
of script output before headers: myurl.py
The relevant part is:
python3: No such file or directory
This shows that the system could not find a python3
binary to execute. The correct path to the python3
interpreter had to be determined using which python3
. This was then edited into the shebang line of the script.