I am trying to set up a simple Python CGI script, but nothing I've tried works. I searched all the Forums and Wiki pages but couldn't find anything that helped. I have both Mini Hosting and Personal Hosting but neither of these setups worked.
The Python script is "HelloWorld.py" as follows:
(Permissions are rwx-r-x-r-x)
Under my home directory I have two links that seem to have been created automatically:
(There are others, which I assume are irrelevant for hosting CGI)
I also created an ".htaccess" file as suggested in the Wiki page and a previous posting on this subject:
(With AND without a blank line on the end. Permissions are rw--r---r--, but also tried with execute added)
I tried with this file in both /home/WWW_pages/ejwells and with a copy in every directory under my home.
Under the Mini Hosting setup WITHOUT .htaccess:
I tested some other combinations, and using my Personal Hosting site, but still got the above errors. It's quite possible there's something I'm doing wrong, but I cannot figure out what!
When I can get the Mini Hosting site to work I will also need to get CGI working on my Personal Hosting site also. I don't mind (too much) if the CGI scripts have to use the same directory, but it would be better if I could keep them in separate directories.
It would REALLY HELP if there was a simple setup guide for CGI that clearly stated what files were needed, what their contents should be, and where they should be located.
Any and all help is appreciated as I've wasted so much time on this!
Best Regards,
Eric.
The Python script is "HelloWorld.py" as follows:
Code: Select all
#!/usr/bin/python
print "Content-Type: text/html"
print ""
print "<html>"
print "<body>"
print "<h1>Hello World!</h1>"
print "</body>"
print "</html>"
Under my home directory I have two links that seem to have been created automatically:
Code: Select all
lrwxrwxrwx 1 root root 36 Aug 13 21:12 /home/e/ejwells/public_cgi -> /usr/local/lib/httpd/cgi-bin/ejwells
lrwxrwxrwx 1 ejwells user 23 Jul 6 2007 /home/e/ejwells/public_html -> /home/WWW_pages/ejwells
I also created an ".htaccess" file as suggested in the Wiki page and a previous posting on this subject:
Code: Select all
AddHandler cgi-script .cgi .pl .py
I tried with this file in both /home/WWW_pages/ejwells and with a copy in every directory under my home.
Under the Mini Hosting setup WITHOUT .htaccess:
Under the Mini Hosting setup WITH ~/.htaccess:Script Location: /home/WWW_pages/ejwells/HelloWorld.py
URL: http://ejwells.users.sonic.net/HelloWorld.py
Result: Treated as "plain text" (as expected)
URL: http://ejwells.users.sonic.net/cgi/HelloWorld.py
Result: "CGIwrap Error: User not found in passwd file."
URL: http://ejwells.users.sonic.net/cgi-bin/HelloWorld.py
Result: "Not Found The requested URL /cgi-bin/HelloWorld.py was not found on this server."
URL: http://ejwells.users.sonic.net/cgi/ejwe ... loWorld.py
Result: "CGIwrap Error: Script File Not Found!"
URL: http://ejwells.users.sonic.net/cgi-bin/ ... loWorld.py
Result: "Not Found The requested URL /cgi-bin/HelloWorld.py was not found on this server."
In summary: using "cgi-bin" in the URL seems to result in "Not Found" errors (despite what is stated in the Wiki and Forum postings). Whenever the script can be accessed via URL it seems to give some sort of "permission/execute" error.Script Location: /home/WWW_pages/ejwells/HelloWorld.py
URL: http://ejwells.users.sonic.net/HelloWorld.py
Result: "Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request."
URL: http://ejwells.users.sonic.net/cgi/HelloWorld.py
Result: "CGIwrap Error: User not found in passwd file."
URL: http://ejwells.users.sonic.net/cgi-bin/HelloWorld.py
Result: "Not Found The requested URL /cgi-bin/HelloWorld.py was not found on this server."
URL: http://ejwells.users.sonic.net/cgi/ejwe ... loWorld.py
Result: "CGIwrap Error: Script File Not Found!"
URL: http://ejwells.users.sonic.net/cgi-bin/ ... loWorld.py
Result: "Not Found The requested URL /cgi-bin/HelloWorld.py was not found on this server."
Script Location: /usr/local/lib/httpd/cgi-bin/ejwells
URL: http://ejwells.users.sonic.net/HelloWorld.py
Result: "Not Found The requested URL /HelloWorld.py was not found on this server." (As expected)
URL: http://ejwells.users.sonic.net/cgi/HelloWorld.py
Result: "CGIwrap Error: User not found in passwd file."
URL: http://ejwells.users.sonic.net/cgi-bin/HelloWorld.py
Result: "Not Found The requested URL /cgi-bin/HelloWorld.py was not found on this server." (Unexpected)
URL: http://ejwells.users.sonic.net/cgi/ejwe ... loWorld.py
Result: "CGIwrap Error: System Error: execv() failed Error: No such file or directory (2)"
URL: http://ejwells.users.sonic.net/cgi-bin/ ... loWorld.py
Result: "Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request."
I tested some other combinations, and using my Personal Hosting site, but still got the above errors. It's quite possible there's something I'm doing wrong, but I cannot figure out what!
When I can get the Mini Hosting site to work I will also need to get CGI working on my Personal Hosting site also. I don't mind (too much) if the CGI scripts have to use the same directory, but it would be better if I could keep them in separate directories.
It would REALLY HELP if there was a simple setup guide for CGI that clearly stated what files were needed, what their contents should be, and where they should be located.
Any and all help is appreciated as I've wasted so much time on this!
Best Regards,
Eric.