据说性能有显著提升,

1、clone源码

git clone https://git.php.net/repository/php-src.git

2、进入 ./configure

./configure --prefix=/www/wdlinux/nginx_php-7.0.0 \
--with-config-file-path=/www/wdlinux/nginx_php-7.0.0/etc \
--with-mcrypt=/usr/include \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-gd \
--with-iconv=/usr/local/libiconv \
--with-zlib \
--enable-xml \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--enable-ftp \
--enable-gd-native-ttf \
--with-openssl \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--without-pear \
--with-gettext \
--enable-session \
--with-curl \
--with-jpeg-dir \
--with-freetype-dir \
--with-fpm-group=www \
--with-fpm-user=www \
--enable-opcache

PS:遇到 libiconv 问题,就去下载一个libiconv 并且把路径配置上.

3、安装,配置。

make
make install
cp php.ini-production /www/wdlinux/nginx_php-7.0.0/etc/php.ini
sed -i 's/short_open_tag = Off/short_open_tag = On/g' /www/wdlinux/nginx_php-7.0.0/etc/php.ini
service php-fpm stop
rm -f /www/wdlinux/nginx_php
ln -sf /www/wdlinux/nginx_php-7.0.0 /www/wdlinux/nginx_php
cp /www/wdlinux/nginx_php-7.0.0/etc/php-fpm.conf.default /www/wdlinux/nginx_php-7.0.0/etc/php-fpm.conf
sed -i 's/user = nobody/user = www/g' /www/wdlinux/nginx_php/etc/php-fpm.conf
sed -i 's/group = nobody/group = www/g' /www/wdlinux/nginx_php/etc/php-fpm.conf
sed -i 's/;pid =/pid =/g' /www/wdlinux/nginx_php/etc/php-fpm.conf
cp -f sapi/fpm/init.d.php-fpm /www/wdlinux/init.d/php-fpm
chmod 755 /www/wdlinux/init.d/php-fpm
mv /www/wdlinux/nginx_php/etc/php-fpm.d/www.conf.default /www/wdlinux/nginx_php/etc/php-fpm.d/www.conf

参考了一下网上的升级5.6的脚本