Reputation: 1010
Is it possible to write a wsgi (werkzeug) application, that returns the output of a php application?
In detail, i have the following problem: We have a couple of old, legacy php applications and need some sort of authentication in front of it, handled by a wsgi or any other python application.
in dummy code it would work like this:
for every request:
valid = check cookie or get-paramter
if valid:
return php application
else:
return "<html>you are not allowed</html>"
i know there are access control mechanisms for apache-mod_wsgi, but the only allow to return true or false.
any ideas?
Upvotes: 1
Views: 214
Reputation: 77912
googling for "python wsgi php", the first result I get is http://pythonpaste.org/wphp/ :
This module allows you to run PHP processes inside of Python, using a WSGI gateway.
but as you mention it never went further than alpha.
A braindead solution would be to serve the php application on a local IP and have your wsgi app just proxy to the php one via urllib, but you'll possibly have to postprocess the reponse body to fix urls etc.
Upvotes: 1