php 内核打补丁之 php-fpm

背景:

php-cgi 目前默认没有打 php-fpm 补丁:

$ ./php-cgi -h

Usage: php-cgi.patch [-q] [-h] [-s] [-v] [-i] [-f <file>]

       php-cgi.patch <file> [args...]

  -a               Run interactively

  -b <address:port>|<port> Bind Path for external FASTCGI Server mode

  -C               Do not chdir to the script's directory

  -c <path>|<file> 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 <file>        Parse <file>.  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 <file>        Load Zend extension <file>.

  -T <count>       Measure execution time of script repeated <count> times.

 

其中没有 -x, -y 的选项,打过补丁后选项会有变化,方可使用:

$ php-cgi -h

Usage: php [-q] [-h] [-s] [-v] [-i] [-f <file>]

       php <file> [args...]

  -a               Run interactively

  -b <address:port>|<port> Bind Path for external FASTCGI Server mode

  -C               Do not chdir to the script's directory

  -c <path>|<file> 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 <file>        Parse <file>.  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 <file>

                   Specify alternative path to FastCGI process manager config file.

  -z <file>        Load Zend extension <file>.

  -T <count>       Measure execution time of script repeated <count> 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 可以使用了.

 

其他的补丁参照此法即可.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值