Setting up Python for CGI

Gregory PiƱero gregpinero at gmail.com
Fri Jul 15 04:12:23 UTC 2005


Ok, I'm doing better, I think the server is _trying_ to execute my script!

Any help would be greatly appriciated.  Below is all the info.

Thanks,

Greg


Here's the message I get when I point my browser to the script:
-----------------------
Internal Server Error

The server encountered an internal error or misconfiguration and was
unable to complete your request.

Please contact the server administrator, webmaster at localhost and
inform them of the time the error occurred, and anything you might
have done that may have caused the error.

More information about this error may be available in the server error log.
Apache/2.0.54 (Ubuntu) PHP/4.3.10-15ubuntu2 Server at 192.168.1.4 Port 3391
--------------------------
Other info:
-My apache log file says "Premature end of script"
-When I run the script from the console it works fine.
-/usr/bin/python is where my python is.
-Here are the permissions on the file:
$ ls -l test.py
-rwxr-xr-x  1 root root 646 2005-07-12 18:57 test.py

And here's the script if that helps: 
----------
#!usr/bin/python

import sys

import cgi

import cgitb

import MySQLdb



cgitb.enable()


sys.stderr=sys.stdout

print """Content-type: text/html\n

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

  <meta content="text/html; charset=ISO-8859-1"

 http-equiv="content-type">

  <title>Make a journal entry</title>



<!-- to correct the unsightly Flash of Unstyled Content.
http://www.bluerobot.com/web/css/fouc.asp -->

<script type="text/javascript"></script>



<style type="text/css" media="all">

    @import "journalread.css";

</style>



</head>

<body>

<h1 >test</h1>    

"""


print "</body></HTML>"




More information about the ubuntu-users mailing list