下载php包和对应的补丁包

1.将fpm打包放到php源代码中

gzip -cd php-5.2.13-fpm-0.5.13.diff.gz | patch -d php-5.2.13 -p1

2.编译安装php 记得带上–enable-cgi –enable-fpm 两个参数

问题1  /usr/local/php/sbin/php-fpm start

Starting php_fpm –fpm-config /usr/local/php-5.2.14/etc/php-fpm.conf

Error in argument 1, char 1: no argument for option -

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

解决方案:

重装编译安装php

参数如下: 注意加红部分

./configure –prefix=/usr/local/php-5.2.14 –with-mysql –with-mysqli=/usr/lib/mysql/mysql_config –with-freetype-dir –with-jpeg-dir –with-png-dir -with-zlib –enable-xml –disable-rpath –enable-discard-path –enable-safe-mode –enable-bcmath –enable-shmop –enable-sysvsem –enable-inline-optimization –with-curl –with-curlwrappers –enable-mbregex–enable-fastcgi –enable-fpm –enable-force-cgi-redirect –enable-mbstring –with-gd –enable-gd-native-ttf –with-openssl –with-mhash –enable-pcntl –enable-sockets –with-ldap –with-ldap-sasl

 

问题2 /usr/local/php/sbin/php-fpm start
Starting php_fpm Jul 13 16:00:09.254822 [ERROR] fpm_unix_conf_wp(), line 124: please specify user and group other than root, pool 'default'
...................................
 

这个把配置文件里面关于user和group的注释去掉即可。

 

 问题3 php网页中提示sockets_create函数没有定义的错误,在编译的时候加上 --eanable-sockets即可。