1
votes

I am new to python cgi programming. I have installed apache 2.2 server on linux mint and I have my html form in var/www folder which is being displayed properly. Action to the form is a cgi script that I've put in the folder /usr/lib/cgi-bin. But on submit, it says "The requested URL /usr/lib/cgi-bin/file.cgi as not found on this server." Does anyone know the fix for this?

1
You might like to use something like mod_wsgi to run your python app over a wsgi interface, rather than using CGI. - Marcin

1 Answers

3
votes
  1. What is the name of your Python program? Is it /usr/lib/cgi-bin/file.cgi?
  2. What are the rights of this file? Can it be read by apache? Can it be executed?
  3. Is first line with #!/usr/bin/env python or similar good? Make sure that this file can be run from command line (ie. shebang is good)
  4. Does apache receive request with that file? Look at apache logs, especially error.log and access.log (probably in /var/log/apache)
  5. Make sure you have enabled ExecCGI for /usr/lib/cgi-bin/ directory in Apache configuration. For examples see at: http://opensuse.swerdna.org/suseapache.html. You can also use ScriptAlias directive.