FastCGI是什么?
FastCGI
PHP的FastCGI使你的所有php应用软件通过mod_fastci运行,而不是mod_phpsusexec.FastCGI应用速度很快 是因为他们持久稳定.不必对每一个请求都启动和初始化.这使得应用程序的开发成为可能,否则在CGI范例是不切实际的(例如一个大型的脚本,或者一个需要 连接单个或多个数据库的应用).
好处
- PHP脚本运行速度更快(3到30倍).PHP解释程序被载入内存而不用每次需要时从存储器读取,极大的提升了依靠脚本运行的站点的性能.
- 需要使用更少的系统资源.由于服务器不用每次需要时都载入PHP解释程序,你可以将站点的传输速度提升很高而不必增加cpu负担.
- 不需要对现有的代码作任何改变.现有的一切都适用于PHP的FastCGI
潜在问题
- 对所有的子目录(/home/USERNAME/public_html/php.ini)你只有一个可用的php.ini文件. 这是优化网站代码所必需的.如果你需要多个php.ini文件以适应不同的脚本需要,你可以在任何子目录禁用PHP的快速CGI,而其余的地方则继续有 效.如果你需要这样做请联系support.
- 你对PHP环境做的任何升级(如php.ini文件的改变)都有几分钟的延迟.这是因为为了更快的速度 你的php.ini文件已经被载入内存,而不是每次需要时再从存储器重新读取.
What is PHP-FPM?
PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites.
These features include:
- 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.)
... and much more.
It was not designed with virtual hosting in mind (large amounts of pools) however it can be adapted for any usage model.