[Twisted-Python] Simple http server to serve php
Logan 4u
logan4u at live.it
Tue Feb 26 15:22:21 EST 2013
Hi! First mail, and first look at this interesting framework that is twisted.
I'm on a Linux Debian. Kindly need help to solve this issue, I've looked at documentation but I miss something.
Need to get up a simple web server that will serve html and php pages. The html works but php show a window where you can choose if save or open the file.
This is what I've got:
#!/usr/bin/env python
import CGIHTTPServer
def main():
server_address = ('', 9090)
handler = CGIHTTPServer.CGIHTTPRequestHandler
handler.cgi_directories = ['./cgi']
server = CGIHTTPServer.BaseHTTPServer.HTTPServer(server_address, handler)
try:
server.serve_forever()
except KeyboardInterrupt:
server.socket.close()
if __name__ == '__main__':
main()
I've looked at documentation but can't understand this point:
from twisted.web import static, twcgi
class PerlScript(twcgi.FilteredScript):
filter = '/usr/bin/php' # >>>> I must point it to the path of php? or php5?
resource = static.File("./cgi") # Points to the perl website
resource.processors = {".php": PerlScript} # Files that end with .pl will be
# processed by PerlScript
resource.indexNames = ['index.php']Every help would be really appreciated. Thanks in advance, BR.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20130226/d012cd97/attachment.htm
More information about the Twisted-Python
mailing list