编译安装 PHP 5.3.2 + php-fpm 通过 

真的是好事成双。

刚刚写完上一篇文章,就收到了PHP Bug Database的提醒,我提交的问题被解决了

原来是因为 我既启用了 php 内置的 mysqli,又自己编译了mysqli扩展.

导致php 遭遇Segmentation fault....

以后这个问题要注意呀,呵呵

为什么要用php-fpm ,因为fastcgi已经很久不更新了.
而且从 php 5.3.x 分支开始,php-fpm 已经成为了php内部项目了。
可见其前景无限.

下载 php 5.3.2源码包,解压,进入目录.
检出php-fpm 源码:
svn co http://svn.php.net/repository/php/php-src/trunk/sapi/fpm sapi/fpm

并重新生成configure文件,
./buildconf --force

我的configure:

$ ./configure --prefix=/usr/local/php --bindir=/usr/local/bin --sbindir=/usr/local/sbin --sysconfdir=/etc/sysconfig --enable-embed=static --enable-fpm --enable-debug --enable-safe-mode --enable-sigchild --enable-magic-quotes --enable-fd-setsize=100 --enable-calendar --enable-dba=shared --enable-exif --enable-ftp --enable-gd-native-ttf --enable-intl --enable-mbstring --enable-pcntl --disable-phar --enable-shmop --enable-soap --enable-sockets --enable-wddx --enable-zip --enable-zend-multibyte --with-libxml-dir --with-libevent-dir=/usr/local/libevent --with-fpm-user=http --with-fpm-group=web --with-config-file-path=/etc --with-exec-dir=/usr/local/bin --with-openssl --with-kerberos --with-pcre-regex --with-zlib --with-bz2 --with-curl --with-gd --with-mhash --with-imap --with-imap-ssl --with-ldap --with-ldap-sasl --with-mcrypt --with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-mysqli=/usr/local/bin/mysql_config --with-pdo-mysql=/usr/local/bin/mysql_config --with-xmlrpc --without-pear

检查依赖,报错:
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing

yum install libc-client-devel.i386

解决.

接下了,make && make install.

如果编译通过,make 报错,make: *** [ext/phar/phar.php] Error 139
那是因为没有禁用掉 phar.
这是个php已知的bug(http://bugs.php.net/bug.php?id=51216),只有等下一个版本修复了.

安装OK后,复制源码包下sapi/fpm/php-fpm.conf 到 /etc/sysconfig/ 下,
稍加编辑,即可

运行 php-fpm,成功跑起来.

评论