PHP(PHP-FPM)手动编译安装

1安装PHP

1.1下载解压

wget http://museum.php.net/php5/php-5.3.5.tar.gz

tarxzvf php-5.3.5.tar.gz

cdphp-5.3.5

1.2配置生成Make

         ./configure--prefix=/usr/local/php --with-mysql=../mysql-5.1.54-linux-x86_64-glibc23/--with-freetype-dir=/usr/lib64/libfreetype.so--with-config-file-path=/usr/local/php/etc --disable-debug --enable-ftp--enable-inline-optimization --enable-mbstring --enable-soap--enable-wddx=shared--enable-xml --with-gd --with-gettext --with-regex=system--with-zlib-dir=/usr/lib --enable-fpm --with-jpeg-dir --with-fpm-user=admin--with-fpm-group=admin --enable-shmop --with-mcrypt --with-mysqli=mysqlnd

PHP源码内已包含PHP-FPM,--enable-fpm就是指编译时带PHP-FPM。

问题1:configure: error:mcrypt.h not found. Please reinstall libmcrypt.

解决方法参考:http://bbs.phpchina.com/thread-220169-1-1.html

 

首先下载libmcrypt源码包:http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/

tar zxvflibmcrypt-2.5.8.tar.gz

cd libmcrypt-2.5.8

./configureprefix=/usr/local

make

make install

这样libmcrypt.so共享库就安装到/usr/local/lib下了

问题2:configure: error:Cannot find libmysqlclient under /usr.

解决方案:http://yangbo.name/archives/984.html

yum install mysql-devel.x86_64

安装后需要创建一个软链接到/usr/lib下,配置php时才会找到:

ln -s /usr/lib64/mysql/libmysqlclient.so.16.0.0/usr/lib/libmysqlclient.so


其他常见问题

参考:http://lxy.me/centos-systems-install-php-encountered-error-solution-highlights.html

1.3编译安装

执行MakeFile文件:

make

make install

2配置FPM

启动命令:

/usr/local/php/sbin/php-fpm

问题1:启动时报错

Jul 25 12:32:24.870810 [ALERT] [pool www]pm.max_spare_servers(0) must be a positive value

Jul 25 12:32:24.870899 [ERROR] failed topost process the configuration

解决办法:

# vi /usr/local/php/etc/php-fpm.conf

pm.start_servers=20

pm.min_spare_servers=5

pm.max_spare_servers=35

将这三行前面的;注释符去掉就行了

3安装PDO_MySQL扩展

wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz

tar xzvfPDO_MYSQL-1.0.2.tgz

cd PDO_MYSQL-1.0.2

/usr/local/php/bin/phpize

./configure--with-php-config=/usr/local/php/bin/php-config

make

make install

在/usr/local/php/etc下新建php.ini,在里面配置扩展

extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/pdo_mysql.so

重启PHP-FPM:

kill -s SIGUSR2 进程号

posted on 2013-07-27 06:19  毛小娃  阅读(251)  评论(0编辑  收藏  举报

导航