Help with Apache 2.0.47 and CGI

Discussion in 'Python' started by Fausto Arinos de A. Barbuto, Nov 10, 2003.

  1. 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
    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?

    Any help will be much appreciated. Thanks.

    Fausto Arinos de A. Barbuto, Nov 10, 2003
    1. Advertisements

  2. Fausto Arinos de A. Barbuto asks

    LoadModule python_module libexec/
    SetHandler python-program
    PythonHandler mod_python.cgihandler

    But there was also a problem reported with 2.3:$

    Emile van Sebille, Nov 10, 2003
    1. Advertisements

  3. Thank you very much Emile -- it is not working yet, although I have
    already downloaded and installed mod_python. Apache says it can't
    find the module even though the bloody little thing is
    right there where it should be, in C:\Apache Group\Apache2\modules.
    It seems that Python 2.3.2 is the bad guy here. A friend of mine has
    Apache 2.0.47 + Python 2.2 and everything works like a charm on his

    I guess I'm on the right track now. Many thanks.

    Fausto Arinos de A. Barbuto, Nov 10, 2003
  4. 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!

    Eric Williams, Nov 10, 2003
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.