Search code examples
apachenginxphplighttpd

What is the relationship between php-cgi and php-fpm?


When we use nginx as webserver, we also use php-fpm. If we use apache or lighttpd, we talk more about php-cgi.

So, what is the relationship and difference between php-cgi and php-fpm?


Solution

  • PHP-CGI is a CGI interface. PHP-FPM is a FastCGI interface.

    CGI gets run once per request. FastCGI gets run once, at server startup, then enters a request loop. This makes CGI simpler, as it has no dependencies; FastCGI is faster, since it avoids any start-up times, but it's a bit more complex to set up.