PHP 版本7.0.7升级7.0.30

参考网站:http://www.lnmp.cn/upgrade-to-php7.1-from-php-7.0.html

PHP下载:http://cn2.php.net/distributions/php-7.0.30.tar.gz

Redis下载:http://pecl.php.net/get/redis-4.0.1.tgz

SSH2下载:http://pecl.php.net/get/ssh2-1.1.2.tgz

 

1升级前的准备:

*将安装包下载到/usr/local/src

2开始升级:

2.1升级PHP

解压

tar -zxvf php-7.0.30.tar.gz

进入目录

cd php-7.0.30/

查询旧的PHP版本

php -v

停止php-fpm服务

service php-fpm stop

查询php configure

php -i | grep configure | sed -e "s/Configure Command =>  //; s/'//g"

编译

./configure  --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir=/usr/local/freetype --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-intl --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext --disable-fileinfo --enable-opcache --with-xsl

备份旧的PHP(这里用上面查到的旧版本号命名即可)

mv /usr/local/php /usr/local/php-7.0.7

建立软连接

ln -s /usr/local/lib/libiconv.so.2 /usr/lib64/

安装,加入iconv模块

make ZEND_EXTRA_LIBS='-liconv' && make install

为了不影响现有网站的运行,这里将沿用 PHP 旧版本 的配置,

cp /usr/local/php-7.0.7/etc/php.ini /usr/local/php/etc/

cp /usr/local/php-7.0.7/etc/php-fpm.conf /usr/local/php/etc/

2.2安装拓展

*redis安装版本4.0.1 ssh2安装版本1.1.8

2.2.1安装redis拓展

打开目录

cd  /usr/local/src

解压

tar -zxvf redis-4.0.1.tgz

进入安装包目录

cd redis-4.0.1

编译安装

/usr/local/php/bin/phpize

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

make && make install

2.2.2安装ssh2拓展

打开目录

cd  /usr/local/src

解压

tar -zxvf ssh2-1.1.2.tgz

进入安装包目录

cd ssh2-1.1.2

编译安装

/usr/local/php/bin/phpize

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

make && make install

2.3启动

启动php服务

service php-fpm start

posted @ 2018-06-21 16:38  staff_w  阅读(368)  评论(0编辑  收藏  举报