Hi all, I am trying to write my first CGI script using Python on my shared virtual web server. I put the script under 'public_html' in the 'cgi-bin' folder on my web server. I made the script executable with the chmod +x command. For the she-bang I am using #! /usr/bin/env python so that the script will be able to find any Python interpreter and not a specific one at a specific location. I made a test form to call the script from when a button is clicked but I just receive a 500 Internal Server error when trying to run this script. I messed around some with the location of the cgi script, which is a .py file in this case, but only received 404 errors. Does anyone reading this know what I am missing? Here is my Python script:
#! /usr/bin/env python
print "Content-type:text/html\r\n\r\n"
print '<html>'
print '<head>'
print '<title>Hello Word - First CGI Program</title>'
print '</head>'
print '<body>'
print '<h2>Hello Word! This is my third or fourth or so CGI program</h2>'
print '</body>'
print '</html>'
Here is my HTML code that calls the Python script:
<!DOCTYPE html>
<head>
<title>Test CGI Scripting With Python</title>
</head>
<body>
<center>
<form action="cgi-bin/hello.py" method="post">
Click this button
<input type="submit" value="Submit" />
</form>
</center>
</body>
</html>
Thank-you for reading this everybody. Respectfully, minus