linux php环境升级,php5.6升级到php7.1.10(Linux环境)
環境說明:nginx+php
無需刪除舊的php5版本,升級步驟如下:
0、,關閉php-fpm(如果有)
service php-fpm stop
1、拉取php7.1.10 tar包
$wget -c http://php.net/distributions/php-7.1.10.tar.gz -O php-7.1.10.tar.gz
2、解壓并進入
$tar -zxvf php-7.1.10.tar.gz
$cd php-7.1.10
3、編譯
$./configure ?--prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-iconv-dir=/usr/local/ ?--enable-safe-mode -enable-fastcgi -enable-force-cgi-redirect --with-gd --with-jpeg-dir=/usr/local/ --with-png-dir=/usr/local/ --enable-sockets --with-mysqli=mysqlnd --with-openssl --enable-soap --enable-mbstring --enable-mbregex --enable-sqlite-utf8 --enable-zip --with-freetype-dir=/usr/local/ --enable-fpm --with-curl --enable-opcache --with-mcrypt --enable-xml --enable-session --enable-ftp --with-mhash --enable-pcntl --with-gettext --with-gettext --enable-bcmath --with-zlib --with-pdo-mysql --enable-sysvshm --enable-sysvsem --enable-shmop
4、安裝
make && make install
(如果提示libiconv模塊相關錯誤,可嘗試使用如下命令安裝
$make ZEND_EXTRA_LIBS='-liconv' && make install)
5、修復配置
1)將擴展放到/usr/local/php/lib/php/extensions/no-debug-non-zts-20160303(根據php.ini配置的擴展目錄存放)
2)將配置文件放到/usr/local/php/etc
3)nginx下站點配置修改:fastcgi_pass ? 127.0.0.1:9000;
6、重啟驗證
service php-fpm restart
service nginx reload
訪問已配置的站點即可
如果出現502 bad gateway 一般都是nginx配置或者文件權限問題
其他注意: 1、php7.1.0以上版本已經廢棄了mcrypt擴展的加解密相關函數,如mcrypt_encrypt、mcrypt_get_iv_size、mcrypt_create_iv等,官方:http://php.net/manual/en/function.mcrypt-encrypt.php#117667? 目前有的替換解決方案:使用openssl_encrypt、openssl_decrypt,使用起來更方便簡潔,網上解決方案地址:https://www.ctolib.com/topics-122535.html? 記得開啟php_openssl擴展
總結
以上是生活随笔為你收集整理的linux php环境升级,php5.6升级到php7.1.10(Linux环境)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: myeclipse搭建php,MyEcl
- 下一篇: php-cgi.sock 权限,php-