Help with Apache 2.0.47 and CGI

Eric Williams s-rube at
Mon Nov 10 04:31:55 CET 2003

Fausto Arinos de A. Barbuto wrote:

> Hi All;
>     I have Apache 2.0.47 installed for a single user on port 8080, Python
> 2.3.2 on C:\Python23 and ActiveState's Perl on C:\Perl. Everything seems
> to work fine after the changes I made in httpd.conf, but I can't for some
> reason run Python scripts that sit on this computer's cgi-bin directory
> (Perl
> scripts run ok). The message I get in either IE 6 and Netscape 7.1 is
> "Internal Server Error". Have any of you had similar experience?
>     Another peculiar thing is that Perl scripts run OK in Netscape 7.1,
> although IE 6 tries to *download* .pl files instead of running them -- as
> if I were ftp-ing a file from some web site. Any clues?

Hallo, Fausto,

You might make sure there's an entry like this:

    AddHandler cgi-script .cgi .py .pl

in either httpd.conf or an .htaccess file for your cgi-bin directory. (Or
use .pyw instead of .py if your programs are like that. ) You should find a
similar entry somewhere for .pl or .cgi files, so just add it there.

I've never used apache on windows, but that's necessary on linux/solaris.

As for the 500 error, you might try to run the files from the command-line
as well, to make sure they aren't crashing and sending tracebacks before
returning to the cgi-handler.

Make sure python's in your path, of course.

If all else fails, add the following line to the import section of your
python cgi scripts:

import cgitb; cgitb.enable()

This can be helpful in debugging, as tracebacks get sent correctly to the
cgi-handler instead of bombing out to stderr, causing an "incomplete
headers" 500 error.

Hope something there helps!


s- should be removed to contact me...

More information about the Python-list mailing list