0,安装 PHP-7.1.6 依赖包
#yumgroupinstall"Developmenttools""DesktopPlatformDevelopment" #yum-yinstallopenssl-devellibcurl-devellibmcryptlibmcrypt-develbzip2-devel
1,编译安装PHP 7.1.6
## 如果需要加入 pgsql扩展 ,则必须先安装好 postgresql
#wgethttp://cn2.PHP.net/get/PHP-7.1.6.tar.gz/from/this/mirror wgethttp://hk1.PHP.net/get/PHP-7.1.6.tar.gz/from/this/mirror #tarxfPHP-7.1.6.tar.gz #cdPHP-7.1.6 #./configure--prefix=/usr/local/PHP-7.1.6\ --with-config-file-path=/usr/local/PHP-7.1.6/etc --with-MysqLi--with-pdo-MysqL--with-pgsql=/usr/pgsql-9.4/\ --with-pdo-pgsql=/usr/pgsql-9.4/--with-openssl\ --with-zlib--with-bz2--with-gettext--with-curl\ --with-gd--with-mhash--with-xmlrpc--with-mcrypt\ --enable-xml--enable-bcmath--enable-shmop --enable-sysvsem--enable-fpm--enable-mbstring\ --enable-pcntl--enable-sockets--enable-soap\ --enable-calendar--enable-dba--enable-exif\ --enable-ftp--with-freetype-dir--with-jpeg-dir--with-png-dir #make&&makeinstall
##在编译好的源码包目录下复制PHP的配置文件 #cp/usr/local/src/PHP-7.1.6/PHP.ini-production/usr/local/PHP-7.1.6/etc/PHP.ini ##复制PHP-fpm配置文件 #cp/usr/local/PHP-7.1.6/etc/PHP-fpm.conf.default/usr/local/PHP-7.1.6/etc/PHP-fpm.conf ##复制www配置文件 #cp/usr/local/PHP-7.1.6/etc/PHP-fpm.d/www.conf.default/usr/local/PHP-7.1.6/etc/PHP-fpm.d/www.conf #vim/usr/local/PHP-7.1.6/etc/PHP-fpm.d/www.conf##修改PHP-fpm模块使用用户和组 user=Nginx group=Nginx ##在编译好的源码包目录下复制PHP-fpm启动脚本到/etc/init.d/ #cp/usr/local/src/PHP-7.1.6/sapi/fpm/init.d.PHP-fpm/etc/init.d/PHP-fpm #chmod755/etc/rc.d/init.d/PHP-fpm #chkconfig--addPHP-fpm #chkconfig--listPHP-fpm #vim/etc/profile.d/PHP.sh##导出命令搜索路径到环境变量 exportPHP_home=/usr/local/PHP-7.1.6/bin/ exportPATH=$PATH:$PHP_home #./etc/profile.d/PHP.sh
2,安装 memcached 缓存扩展
#yuminstallcyrus-saslcyrus-sasl-devel-y##memcached的依赖包 #peclinstallmemcached ##PHP-memcached扩展依赖库 #wgethttps://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz #tarxflibmemcached-1.0.18.tar.gz #cdlibmemcached-1.0.18 #./configure--prefix=/usr/local/libmemcached-1.0.18--with-memcached #make&&makeinstall ##要使用pecl命令的前提是已经编译安装好的PHP中含有pear命令包,不过PHP-7.1.6中默认安装有pear #/usr/local/PHP-7.1.6/bin/peclinstallmemcached
libmemcached directory [no] : 填入刚才libmemcached的编译安装目录地址
##pecl命令安装完memcached后会提示你将memcached.so追加到PHP.ini配置文件中 ##在PHP配置中追加memcached模块 #echo"extension=memcached.so">>/usr/local/PHP-7.1.6/etc/PHP.ini原文链接:https://www.f2er.com/centos/377130.html