M
mpc
hello,
how does one run a PHP page with a python webserver?
Lets say i have a simple python web server running
/path/webserver.py
#!/usr/bin/env
python
from BaseHTTPServer import HTTPServer
from CGIHTTPServer import CGIHTTPRequestHandler
serve = HTTPServer(("",8080),CGIHTTPRequestHandler)
serve.serve_forever()
Also lets say i am interested in hosting a simple.php in the cgi-bin
directory.
/path/cgi-bin/simple.php
<html>
<head>
<title>A simple php script.</title>
</head>
<? print(Date("1 F d, Y")); ?>
<body>
</body>
</html>
The webserver starts up and hosts html and python cgi's just fine
but nothing will come up when we go to http://localhost:8080/cgi-bin/simple.php
I get the following errors.
with normal user
localhostath user$ python webserver.py
localhost - - [15/Sep/2008 16:17:59] "GET /cgi-bin/example.php HTTP/
1.1" 200 -
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/CGIHTTPServer.py", line 251, in run_cgi
os.execve(scriptfile, args, os.environ)
OSError: [Errno 8] Exec format error
localhost - - [15/Sep/2008 16:17:59] CGI script exit status 0x7f00
localhostath user$ sudo python webserver.py
Password:
localhost - - [15/Sep/2008 16:18:29] "GET /cgi-bin/example.php HTTP/
1.1" 200 -
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/CGIHTTPServer.py", line 251, in run_cgi
os.execve(scriptfile, args, os.environ)
OSError: [Errno 13] Permission denied
Is there something I can add to my python webserver so that it will
properly run php files?
how does one run a PHP page with a python webserver?
Lets say i have a simple python web server running
/path/webserver.py
#!/usr/bin/env
python
from BaseHTTPServer import HTTPServer
from CGIHTTPServer import CGIHTTPRequestHandler
serve = HTTPServer(("",8080),CGIHTTPRequestHandler)
serve.serve_forever()
Also lets say i am interested in hosting a simple.php in the cgi-bin
directory.
/path/cgi-bin/simple.php
<html>
<head>
<title>A simple php script.</title>
</head>
<? print(Date("1 F d, Y")); ?>
<body>
</body>
</html>
The webserver starts up and hosts html and python cgi's just fine
but nothing will come up when we go to http://localhost:8080/cgi-bin/simple.php
I get the following errors.
with normal user
localhostath user$ python webserver.py
localhost - - [15/Sep/2008 16:17:59] "GET /cgi-bin/example.php HTTP/
1.1" 200 -
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/CGIHTTPServer.py", line 251, in run_cgi
os.execve(scriptfile, args, os.environ)
OSError: [Errno 8] Exec format error
localhost - - [15/Sep/2008 16:17:59] CGI script exit status 0x7f00
localhostath user$ sudo python webserver.py
Password:
localhost - - [15/Sep/2008 16:18:29] "GET /cgi-bin/example.php HTTP/
1.1" 200 -
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/CGIHTTPServer.py", line 251, in run_cgi
os.execve(scriptfile, args, os.environ)
OSError: [Errno 13] Permission denied
Is there something I can add to my python webserver so that it will
properly run php files?