<?php include "pyphp.php"; pyphp_run("mywsgiapp"); ?> # vim:syntax=python: def mywsgiapp(environ, start_response): start_response('200 OK', [('Content-type','text/plain')]) # access the php api via environ['php'] ver = environ['php'].phpversion() return ['Hello world! via (php %s) \n'%ver]
<?php include "pyphp.php"; pyphp_run(); ?> # vim:syntax=python: print "Hello World"
<?php include "pyphp.php"; pyphp_run("test_app"); ?> # vim:syntax=python: import cgi, time def test_app(environ, start_response): start_response('200 OK', [('Content-Type', 'text/html')]) # php proxy php=environ['php'] # calling a php function php.header("Content-Type: text/html") yield '''<html><head><title>Hello World!</title></head> <body><p>Hello World!</p> <br/> <form action="demo_wsgi2.php" method="GET"> <input type="text" name="a" value="test value"/> <input type="submit" name="s" value="submit"/> </form> <br/> <br/> ''' # printing from python print "Hello from python time is ", time.ctime(), "<br><br>"
<?php include "pyphp.php"; pyphp_run("testapp"); ?> # vim:syntax=python: from demo_wsgi3_testapp import testapp