Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

Python CGI Server - Perfect To Deliver PHP Files Within A Python CherryPy Application

Project description

Mit dem CherryPy Tool cherrypy-cgiserver kann man aus CherryPy einen vollwertigen CGI-Server (Common Gateway Interface) machen. Damit lassen sich sogar PHP-Dateien ausführen und ausliefern. Es muss nur der PHP-Interpreter auf dem Computer installiert sein. Ein zusätzlicher Apache-Server ist nicht nötig.

So einfach lässt sich aus CherryPy ein vollwertiger PHP-Server machen:

#!/usr/bin/env python
# coding: utf-8

import os
import cherrypy
import cpcgiserver

THISDIR = os.path.dirname(os.path.abspath(__file__))

def main():
    config = {
        "global": {
            "server.socket_host": "0.0.0.0",
            "server.socket_port": 8080,
        },
        "/": {
            "tools.cgiserver.on": True,
            "tools.cgiserver.dir": THISDIR,
            "tools.cgiserver.base_url": "/",
            "tools.cgiserver.handlers": {".php": "/usr/bin/php-cgi"},
        }
    }
    app = cherrypy.Application(None, config = config)
    cherrypy.quickstart(app, config = config)

if __name__ == "__main__":
    main()

Installation

pip install cherrypy-cgiserver or easy_install cherrypy-cgiserver

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for cherrypy-cgiserver, version 0.3.6
Filename, size File type Python version Upload date Hashes
Filename, size cherrypy-cgiserver-0.3.6.tar.gz (50.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page