Run/Execute python file on Apache2 with local server, ubuntu14.04LTS

Summary

 I tried to run my python3 scripts on my local server with apache2 and ubuntu14.04LTS. I had permission problems and addressed it.

Problem


My firefox shows

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at webmaster@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.

Apache/2.4.7 (Ubuntu) Server at localhost Port 80
 
 
also, in log file (/var/log/apache2/error.log), it says "Permission denied".

[Sun Jun 05 14:33:58.930599 2016] [core:notice] [pid 18049] AH00094: Command line: '/usr/sbin/apache2'
[Sun Jun 05 14:34:02.586809 2016] [cgi:error] [pid 18052] [client 127.0.0.1:38168] AH01215: (13)Permission denied: exec of '/var/www/html/cgi-bin/first.py' failed
[Sun Jun 05 14:34:02.588022 2016] [cgi:error] [pid 18052] [client 127.0.0.1:38168] End of script output before headers: first.py

Solution

Allow people to execute file.
sudo chmod 755 filename



Bibliography

コメント