RedHat 8.0 Apache + Python CGI segmentation faults

Bengt Richter bokr at oz.net
Sun Feb 23 21:39:59 CET 2003


On Sun, 23 Feb 2003 17:11:46 GMT, "Steve Holden" <sholden at holdenweb.com> wrote:

>"Bengt Richter" <bokr at oz.net> wrote ...
>> On Sat, 22 Feb 2003 19:16:53 GMT, "Steve Holden" <sholden at holdenweb.com>
>wrote:
>>
>> >Couldn't find anything about this in Google. A new machine is running RH
>8,
>> >and the Apache web server is working. However, attempts to run Python CGI
>> >scripts result in segmentation faults, even though the scripts will run
>> >quite happily under the user "apache" identity.
>> >
>> OTTOMH, have you checked the environment that apache is running your CGI
>in vs
>> user "apache" as a logged-in user? Have you checked the apache httpd.conf
>(IIRC)
>> parameters for your situation? Virtual hosting? suEXEC'ing you as user
>instead
>> of apache? User "nobody"? is it finding the right version of python?
>> Are you using a C/C++ extension that requires an old C/C++ .so library and
>is
>> being directed by symlink to an incompatible new version?
>>
>> >Is this a known phenomenon, or am I going to have to get the dread gdb
>out?
>> >All the error log records is several segmentation faults for each
>attempted
>> >CGI access.
>>
>> Just guessing on a few things to check. I haven't used RH8 (have they
>switched
>> to proper defaulting of 2.2.2 yet, with internal use of 1.5.2 isolated if
>they
>> still need that?)
>>
>
>It's a great list, but most of it isn't likely to apply - this error even
>occurs with the following CGI:
>
>#!/usr/bin/python
>print """Content-Type: text/html
>
><html>
><head><title>Test Page</title></head>
><body>
><h2>Hello!</h2>
></body>
></html>
>"""
>
Try executing this as cgi (don't forget to chmod) by looking with
your browser at

    http://<yoursite>/cgi-bin/trypy

or wherever you put it

====< trypy >================
#!/bin/sh
#
echo Content-type: text/plain
echo
which python  2>&1
which ldd  2>&1
python -uv <<EOF 2>&1
print '--- This is a test ---'
EOF
echo --- back in sh ---
echo $PATH
which python | xargs ldd
=============================

And compare with what you get running this script directly (as user apache?)
where your python script "worked."


>That being the case, I'm force to conclude it's something in the server -
Maybe get the results of the above before concluding conclusively?

>the httpd.conf file is pretty standard, and I have the code running on other
>Apache installations both under Windows and Linux. I did find an Apache bug
>report [14692] that looked kind of relevant, so I'm compiling the upgrade as
>I write. [aarrgghh! I need an updated mod_auth_mysql, and I can't even find
>where it's required!].
>
>Anyway, the main point of this reply is to let you know that RH8.0 doesn't
>use Python 1.5.2 any more, as far as I can see from a superficial look. The
>/usr/bin/python binary is 2.2.1, which is about as up-to-date as a release
>process can be, and shouldn't produce compatibility problems with an upgrade
>to 2.2.2.
Famous last words ;-)

>
>I recently had email from Todd Warner at Red Hat: apparently developers will
>be attending PyCon, and they want to talk about the recent developments in
>their use of Python. Although there's nothing formally scheduled, I think
>this will be a primary candidate for use of the Open Space that we have left
>for at-conference scheduled presentations.
>
>Thanks for your input: it could easily have been one of the possible
>problems you mentioned!
>
You're welcome. Hope the little script tells you more.

Regards,
Bengt Richter




More information about the Python-list mailing list