在lnmp环境下,将原来的PHP7.0升级到PHP7.2

基础环境:

  系统:centos6.8   环境:lnmp  

停止PHP7.0的版本,在做如下操作:

  1.下载php-7.2.6.tar.bz2软件包放在/opt 路径下

    mkdir /usr/local/php7.2

  2.tar xf php-7.2.6.tar.bz2

  3.cd php-7.2.6

  4../configure --prefix=/usr/local/php7.2 --with-config-file-path=/usr/local/php7.2/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=/usr/local/curl --enable-mbregex --enable-mbstring --enable-intl --enable-ftp --with-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext --enable-fileinfo --enable-opcache --with-xsl

  5.make && make install

  6.cp /opt/php-7.2.6/php.ini.devolepment  /usr/local/php7.2/etc/php.ini

  7.cp /usr/local/php7.2/etc/php-fpm.conf.default  /usr/local/php7.2/etc/php-fpm.conf

  8.cd /etc/init.d/

  9.改PHP7.0的启动脚本,将路径改成/usr/local/php7.2

    

  10.改环境变量,将之前的PATH改成php7.2的路径

  11.php -v  查看版本是否升级成功

  12.运行新版本的php,完成升级。

    service php-fpm start

原文地址:https://www.cnblogs.com/new-journey/p/10483805.html