[mod_python] Supporting legacy PHP pages while still giving mod_python the root

VanL vlindberg at verio.net
Mon Mar 8 15:31:35 EST 2004


I have an apache 1.3.x + mod_python + quixote intranet.  I also have 
some legacy PHP pages.  I am currently running mod_python off a 
subdirectory, but I would like to make mod_python the root but still 
maintain PHP access to the old pages.

In my mod_python handler, I currently have the following code

def handler(req):
    # Try to find php
    urlpath = str(req.uri).lower()
    if urlpath.find('.php') != -1:
        # Found a php extension
        return apache.DECLINED
        # Continue with mod_python stuff

 From the docs, this would appear to pass this request on to the next 
handler, presumably the one set by the SetHandler function in the 
httpd.conf.  Unfortunately, it doesn't work; it ends up giving me a 404 

I know this code is being executed; if I change apache.DECLINED to 
apache.HTTP_INTERNAL_SERVER_ERROR, an error is thrown whenever I have 
.php in the request uri.  

Is there a way to make sure that the path is appropriately followed and 
the php file appropriately executed if we find ".php"?



More information about the Mod_python mailing list