NoteDeep
FastCGI是Web服务器(如:Nginx、Apache)和处理程序之间的一种通信协议,它是与Http类似的一种应用层通信协议,注意:它只是一种协议!

在网络应用场景下,PHP并没有像Golang那样实现http网络库,而是实现了FastCGI协议,然后与web服务器配合实现了http的处理,web服务器来处理http请求,然后将解析的结果再通过FastCGI协议转发给处理程序,处理程序处理完成后将结果返回给web服务器,web服务器再返回给用户

web服务器(nginx) 和 php程序 之间的通信协议。
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/odp/webroot/notedeep/build$fastcgi_script_name;
include fastcgi_params;
try_files $uri =404;
}

可以理解为nginx将请求通过fastcgi协议,传送到127.0.0.1:9000端口。


FPM(FastCGI Process Manager)是PHP FastCGI运行模式的一个进程管理器,

PHP实现了FastCGI协议的解析,但是并没有具体实现网络处理,所以需要 php-fpm(fastcgi进程管理器)是一个替代的php fastcgi实现,其中一些额外的功能可用于任何规模的站点,特别是更繁忙的站点。

https://php-fpm.org/

Adaptive process spawning (NEW!)
Basic statistics (ala Apache's mod_status) (NEW!)
Advanced process management with graceful stop/start
Ability to start workers with different uid/gid/chroot/environment and different php.ini (replaces safe_mode)
Stdout & stderr logging
Emergency restart in case of accidental opcode cache destruction
Accelerated upload support
Support for a "slowlog"
Enhancements to FastCGI, such as fastcgi_finish_request() - a special function to finish request & flush all data while continuing to do something time-consuming (video converting, stats processing, etc.)


评论列表