1.停止相关服务
# service php-fpm stop
2.删除已经安装的 PHP 相关包
# yum remove php*
3.安装新版本 PHP
解压
# tar zxvf php-7.1.8.tar.gz
# cd php-7.1.8
配置
# ./configure --prefix=/usr/local/php --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-xmlrpc --with-xsl --with-zlib --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip --with-jpeg-dir --disable-debug
配置有错误可以看下
# ./configure --help
这里配置的时候遇到了报错
configure: error: Please reinstall the libzip distribution。
解决办法安装libzip就行
# tar -zxvf libzip-1.5.2.tar.gz
# cd libzip-1.5.2
# mkdir build && cd build && /usr/local/bin/cmake .. && make && make install
然后这里又报错,cmake版本过低,需新版本
# wget https://cmake.org/files/v3.3/cmake-3.3.2.tar.gz
# tar xzvf cmake-3.3.2.tar.gz
# cd cmake-3.3.2
# ./bootstrap
# gmake
# make install
搞定这些之后在重新configure
编译安装
# make && make install
配置文件
# cp php.ini-development /usr/local/php/lib/php.ini
# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
# cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
# cp -R ./sapi/fpm/php-fpm /etc/init.d/php-fpm
4.重新启动相关服务
/usr/local/php/sbin/php-fpm -R