PHP CGI (Common Gateway Interface) is a web technology and protocol that defines a way for a web server (HTTP server) to interact with external applications, e.g. PHP. ... CGI is used as an interface between the web server and the additionally installed applications generating dynamic web content.
PHP-FPM (is a web tool used to speed up the performance of a website
Let me tell you about both using simple Description and Pros and cons...
It is a specification “protocol” for transferring information between a Web server and a CGI program.
A CGI program is any program designed to accept and return data that conforms to the CGI specification. Basically you can say, it’s a way to run a server-side script (PHP, Perl, Python) when an HTTP request comes.
- It has Better security than FPM as PHP code execution is isolated from a web server.
- The legacy way of running applications.
- Very poor performance for busier websites.
PHP FastCGI Process Manager (PHP-FPM) is an alternative FastCGI daemon for PHP that allows a website to handle strenuous loads. PHP-FPM maintains pools (workers that can respond to PHP requests) to accomplish this. PHP-FPM is faster than traditional CGI-based methods, such as SUPHP, for multi-user PHP environments. It does not overload a system’s memory with PHP from Apache processes.
Advantages and Disadvantages:-
- It has a modern and optimized way of running applications.
- Robust performance for busier websites and low resources consumption.
- Smaller memory footprint, graceful reload without stopping other queries.
- Low security as compared to PHP-CGI.
- Requires more configuration than PHP-CGI.
Hope this clears your idea about PHP-CGI and PHP-FPM
Cheers - Jimmy Wick