I ran into a problem with one of my python scripts the other day and noticed from the Apache logs that it was causing a segfault somewhere. This is the first time I have had to deal with a segfault in a web based application so I looked around for a debugging solution. I found that mod_python has has a flag that will trigger Apache to start a console running PDB. In order to get this working, “PythonEnablePdb On” needs to be added to the Apache config for the site running the Mod_python script and Apache needs to be ran with the following command.

apache2ctl -DONE_PROCESS

For users using Apache 1.3 use the “-X” in place of the “-DONE_PROCESS” flag. Apache will wait until the page is requested and start the debugging console where the breakpoint is specified.

    Post new comment

    The content of this field is kept private and will not be shown publicly.
    • Web page addresses and e-mail addresses turn into links automatically.
    • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
    • Lines and paragraphs break automatically.

    More information about formatting options