较新版本(如5.6)的PHP已经自带FPM(fastCGI process manager,FastCGI进程管理器)模块,用来对PHP解析实例进行管理,优化解析效率,因此在配置PHP编译选项时应添加"--enable-fpm"以启用此模块。为了提高PHP解析效率,建议将相应版本的ZendGuardLander也装上
=======================================================================================
1)编译安装php
[root@localhost ~]# yum -y install gd libxml2-devel libjpeg-devel libpng-devel
导入php软件包(php-5.6.39.tar)
[root@localhost ~]# tar xf php-5.6.39.tar.gz -C /usr/src
[root@localhost ~]# cd /usr/src/php-5.6.39/
[root@localhost php-5.6.39]# ./configure --prefix=/usr/local/php5 --with-gd --with-zlib --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config
--with-config-file-path=/usr/local/php5 --enable-mbstring --enable-fpm --with-jpeg-dir=/usr/lib && make && make install
...............
.....................
ln -s -f phar.phar /usr/local/php5/bin/phar
Installing PDO headers: /usr/local/php5/include/php/ext/pdo/
[root@localhost php-5.6.39]# ls
php.ini-development //用于测试环境
php.ini-production //用于生产环境
2)安装后的调整
[root@localhost php-5.6.39]# cp php.ini-production /usr/local/php5/php.ini //将用于生产环境的包复制到php.ini 中
[root@localhost php-5.6.39]# ln -s /usr/local/php5/bin/* /usr/local/bin/
[root@localhost php-5.6.39]# ln -s /usr/local/php5/sbin/* /usr/local/sbin/
[root@localhost php-5.6.39]# cd
导入zend-loader-php5.6-linux-x86_64_update1.tar.gz(加速包)
[root@localhost ~]# ls
anaconda-ks.cfg mysql-5.7.24.tar.gz php-5.6.39.tar.gz
initial-setup-ks.cfg original-ks.cfg zend-loader-php5.6-linux-x86_64_update1.tar.gz
[root@localhost ~]# tar xf zend-loader-php5.6-linux-x86_64_update1.tar.gz -C /usr/src
[root@localhost ~]# cd /usr/src/zend-loader-php5.6-linux-x86_64/
[root@localhost zend-loader-php5.6-linux-x86_64]# ls
opcache.so README.txt ZendGuardLoader.so
[root@localhost zend-loader-php5.6-linux-x86_64]# cp ZendGuardLoader.so /usr/local/php5/lib/php/
[root@localhost zend-loader-php5.6-linux-x86_64]# vim /usr/local/php5/php.ini
在末尾添加两行命令:
zend_extension=/usr/local/php5/lib/php/ZendGuardLoader.so
zend_loader.enabled=1 //开关
[root@localhost zend-loader-php5.6-linux-x86_64]# cd
[root@localhost ~]#
此时PHP安装完成