Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between FPM and WSGI

Here is what I understand thus far.

PHP-FPM and WSGI are layers upon FastCGI?

So would it be right to say that WSGI is Python's FPM?

like image 308
Abdelouahab Pp Avatar asked Oct 21 '22 14:10

Abdelouahab Pp


1 Answers

WSGI is not actually a layer on FastCGI, but a specification for writing Python web applications that is sufficiently generic that it may attach to many web servers or adapters which in turn may speak to many other technologies, including FastCGI. But FastCGI itself, which is a protocol for a web server to connect to a long-running process, need not be involved at all in a WSGI installation—e.g. the mod_wsgi Apache module, which exposes WSGI to your Python application directly from Apache and does not require you to run a separate long-running process.

WSGI is defined in PEP 333. A simple application, taken from that specification, looks like this:

def simple_app(environ, start_response):
    """Simplest possible application object"""
    status = '200 OK'
    response_headers = [('Content-type', 'text/plain')]
    start_response(status, response_headers)
    return ['Hello world!\n']
like image 80
zigg Avatar answered Oct 27 '22 11:10

zigg