Let me tell you about both using simple Description and Pros and cons...
PHP-CGI
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.
Pros
- It has Better security than FPM as PHP code execution is isolated from a web server.
Cons
- The legacy way of running applications.
- Very poor performance for busier websites.
PHP-FPM
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:-
Pros
- 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.
Cons
- 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