0

Sorry for the newb question, I just got a VPS and I've installed Python and moved my site over. Everything works, but when I try to run scripts (in /cgi-bin/ ) I get 500 Internal Server Error. Where can I locate the error log for this?

My info is: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at

Thanks in advance!

Parker
  • 101
  • 1
  • 4
  • What distribution? Are you using mod_wsgi (with a framework like django?) or running python scripts as a CGI, etc? – DerfK Oct 27 '10 at 22:55

2 Answers2

0
  1. Check interpreter is addedd to script, add either #!/usr/bin/python or #!/usr/bin/env python

  2. Check logs at /var/log/apache2 for detailed errors, if any. i found missing pip packages in the log.

    ubuntu@ip:/var/log/apache2$ ll total 36 drwxr-x--- 2 root adm 4096 Nov 6 18:08 ./ drwxrwxr-x 12 root syslog 4096 Nov 6 18:57 ../ -rw-r----- 1 root adm 9543 Nov 6 21:36 access.log -rw-r----- 1 root adm 15941 Nov 6 21:35 error.log -rw-r----- 1 root adm 0 Nov 6 18:08 other_vhosts_access.log ubuntu@ip:/var/log/apache2$

Access the script, example tail -f http://<ip>/cgi-bin/test-db.py

[Sun Nov 06 21:35:18.928560 2022] [cgi:error] [pid 8303:tid 139738648380992] [client 49.207.201.90:5556] AH01215: Traceback (most recent call last):: /usr/lib/cgi-bin/test-db.py
[Sun Nov 06 21:35:18.928839 2022] [cgi:error] [pid 8303:tid 139738648380992] [client 49.207.201.90:5556] AH01215:   File "/usr/lib/cgi-bin/test-db.py", line 3, in <module>: /usr/lib/cgi-bin/test-db.py
[Sun Nov 06 21:35:18.929051 2022] [cgi:error] [pid 8303:tid 139738648380992] [client 49.207.201.90:5556] AH01215:     import pymysql: /usr/lib/cgi-bin/test-db.py
[Sun Nov 06 21:35:18.929213 2022] [cgi:error] [pid 8303:tid 139738648380992] [client 49.207.201.90:5556] AH01215: ModuleNotFoundError: No module named 'pymysql': /usr/lib/cgi-bin/test-db.py
[Sun Nov 06 21:35:18.941377 2022] [cgi:error] [pid 8303:tid 139738648380992] [client 49.207.201.90:5556] End of script output before headers: test-db.py
0

/etc/httpd/logs/

Parker
  • 101
  • 1
  • 4