背景:
php-cgi 目前默认没有打 php-fpm 补丁:
$ ./php-cgi -h
Usage: php-cgi.patch [-q] [-h] [-s] [-v] [-i] [-f ]
php-cgi.patch [args...]
-a Run interactively
-b | Bind Path for external FASTCGI Server mode
-C Do not chdir to the script's directory
-c | Look for php.ini file in this directory
-n No php.ini file will be used
-d foo[=bar] Define INI entry foo with value 'bar'
-e Generate extended information for debugger/profiler
-f Parse . Implies `-q'
-h This help
-i PHP information
-l Syntax check only (lint)
-m Show compiled in modules
-q Quiet-mode. Suppress HTTP Header output.
-s Display colour syntax highlighted source.
-v Version number
-w Display source with stripped comments and whitespace.
-z Load Zend extension .
-T Measure execution time of script repeated times.
其中没有 -x, -y 的选项,打过补丁后选项会有变化,方可使用:
$ php-cgi -h
Usage: php [-q] [-h] [-s] [-v] [-i] [-f ]
php [args...]
-a Run interactively
-b | Bind Path for external FASTCGI Server mode
-C Do not chdir to the script's directory
-c | Look for php.ini file in this directory
-n No php.ini file will be used
-d foo[=bar] Define INI entry foo with value 'bar'
-e Generate extended information for debugger/profiler
-f Parse . Implies `-q'
-h This help
-i PHP information
-l Syntax check only (lint)
-m Show compiled in modules
-q Quiet-mode. Suppress HTTP Header output.
-s Display colour syntax highlighted source.
-v Version number
-w Display source with stripped comments and whitespace.
-x, --fpm Run in FastCGI process manager mode.
-y, --fpm-config
Specify alternative path to FastCGI process manager config file.
-z Load Zend extension .
-T Measure execution time of script repeated times.
启动是可以让 php-cgi 以 php-fpm 模式工作:
$php-cgi --fpm --fpm-config ~/php/etc/php-fpm.conf
方法:
1. http://museum.php.net/ 下载待打补丁的版本,以 php-5.2.10 为例子.
$cd ~/ && mkdir src && cd src && wget "http://museum.php.net/php5/php-5.2.10.tar.bz2" && tar -jxf php-5.2.10.tar.bz2
2. 到 http://php-fpm.org/downloads/ 下载对应版的补丁文件,并打补丁.
$ cd ~/src && wget "http://php-fpm.org/downloads/php-5.2.10-fpm-0.5.13.diff.gz" && gzip -cd php-5.2.10-fpm-0.5.13.diff.gz | patch -d php-5.2.10 -p1
如此便完成了打补丁的工作,在编译 php 时, ./configure 参数中 --enable-fpm 可以使用了.
其他的补丁参照此法即可.