php5.2.17及手动打补丁php-fpm安装
yum -y install perl-DBI curl-devel libcurl-level mysql mysql-devel gcc gcc-c++ openssl openssl-devel pcre pcre-devel zlib zlib-devel bzip2 bzip2-devel libxml2 libxml2-devel libmhash libmhash-devel libjpeg libjpeg-devel libpng libpng-devel
2.下载php和php-fpm
wget http://soft.7dot.com/soft/php-5.2.17.tar.gz
wget -c http://php-fpm.org/downloads/php-5.2.17-fpm-0.5.14.diff.gz
3.安装编译php
tar zxvf php-5.2.17.tar.gz
gzip -cd php-5.2.17-fpm-0.5.14.diff.gz | patch -d php-5.2.17 -p1
cd php-5.2.17
./configure --prefix=/usr/local/php --enable-fastcgi --enable-zip --enable-fpm --enable-gd-native-ttf --with-config-file-path=/usr/local/php/etc --with-config-file-scan-dir=/usr/local/php/etc/php.d --with-bz2 --with-curl --with-libxml-dir --with-gd --with-jpeg-dir --with-freetype-dir --with-png-dir --with-mcrypt --with-mhash --enable-mbstring --with-kerberos --with-gettext --enable-bcmath --with-mysql --with-mysqli --with-sqlite --enable-pdo --with-pdo-mysql --with-openssl --enable-ftp --with-pear --with-zlib --enable-inline-optimization --enable-calendar --enable-magic-quotes --enable-sockets --enable-sysvsem --enable-sysvshm --enable-sysvmsg --disable-debug
make
make test
make install
4.编译过程可能出错的地方及改错方法
1)mcrypt.h not found. Please reinstall libmcrypt
centos源不能安装libmcrypt-devel,由于版权的原因没有自带mcrypt的包,有两种方法解决,一种是使用第三方源,这样还可以使用yum来安装,简单方便,坏处是第三方源多少有中不可靠的感觉。
解决办法一
安装第三方yum源
wget http://www.atomicorp.com/installers/atomic
使用yum命令安装
yum install php-mcrypt libmcrypt libmcrypt-devel
解决办法二、
使用php mcrypt 前必须先安装Libmcrypt
libmcrypt源码安装方法:
cd /usr/local/srcwget http://softlayer.dl.sourceforge.net/sourceforge/mcrypt/libmcrypt-2.5.8.tar.gztar -zxvf libmcrypt-2.5.8.tar.gzcd /usr/local/src/libmcrypt-2.5.8./configure --prefix=/usr/localmakemake install
2)error: Cannot find libmysqlclient under /usr. Note that the MySQL client library is not bundled anymore!
问题是64位系统中 libmysqlclient 默认安装到了 /usr/lib64/mysql/ 目录下
而/usr/lib 目录下没有相应文件,但是php编译时,要去 /usr/lib目录下查找
解决方法:
ln -s /usr/lib64/mysql/libmysqlclient.so.16.0.0 /usr/lib/libmysqlclient.so
3)/usr/bin/ld: cannot find -lltdl
collect2: ld returned 1 exit status
make: *** [libphp5.la] Error 1
深究该问题应该是该库的头文件库没有安装所致
yum list all | grep ltdl
yum -y install libtool-ltdl-devel.x86_64
4)
##根据Wrote PEAR system config file at: /usr/local/php/etc/pear.conf
##You may want to add: /usr/local/php/lib/php to your php.ini include_path
##Installing PDO headers: /usr/local/php/include/php/ext/pdo/
##这个信息,我们需要在当前 php-5.2.17目录下执行
cp php-5.2.17/php.ini-dist /usr/local/php/lib/php.ini
5)
启动 PHP-FPM 时,如遇到下面这个错误信息:
Starting php_fpm Feb 07 10:52:35.508786 [ERROR] fpm_unix_conf_wp(), line 124: please specify user and group other than root, pool 'default'
打开 php-fpm.conf 配置文件,找到下面这个部分:
Unix user of processes
Unix group of processes
去掉注释,并将user和group改为实际实用的用户和组即可。比如user=nginx group=nginx
5 启动服务
/usr/local/php/sbin/php-fpm start
service nginx restart
service mysqld restart
其它的一些细节设置没有一一详写,请大家指教改正!
上一篇: 求正则,获取图片src的地址