由于无法直接从PHP5.4升级PHP7.3,忙活大半晚上将PHP手动升级了
重要tips:为防止误操作,提前快照备份
以下为过程简略记录
- 1.原来配置是PHP5.4,根据wordprss官网最新系统环境requirement指南要求需升级PHP至7.3版;
To run WordPress we recommend your host supports: PHP version 7.3 or greater. MySQL version 5.6 or greater OR MariaDB version 10.1 or greater. HTTPS support
------------------------------ 系统环境:centos7.0 ×64
- 2.PHP官网下载PHP7.3源码, tar zxvf 解压,./configure编译安装,提示libzip版本过低;
https://www.php.net/downloads.php
./configure +参数
make && make install
- 3.yum remove libzip 移除旧版libzip(执行后感觉有风险,移除了某些关联的库),官网下载libzip手动编译安装;
https://libzip.org/download/
- 4.libzip编译过程中提示cmake版本2.8.12.2 过低,下载cmke最新版3.14.3编译好的安装包;
https://cmake.org/download/
- 5.安装编译好的源码,修改.bash_profile,不生效,可能是因为旧版cmake没卸载的原因, 下载源码包,手动编译安装cmake;
- 6.回溯安装PHP7.3,安装完编辑/etc/profile文件,添加PHP7.3的bin 路径,保存后source重载文件
#vi /etc/profile
export PATH="/usr/local/php7/bin:$PATH"
- 7.修改apache的配置文件httpd.conf,将下面这行配置注释掉,service httpd restart 重启Apache,升级完成;
#LoadModule php5_module modules/libphp5.so
LoadModule php7_module modules/libphp7.so
- 8.参考资料:(https://www.cnblogs.com/tulips-lily/p/7098374.html)
PHP7.3编译参数
--prefix=/usr/local/php7 --with-apxs2=/usr/local/apache/bin/apxs --with-libiconv-prefix=/usr/local/lib --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-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip
其中:
--prefix=/usr/local/php7 是PHP的安装路径
--with-apxs2=/usr/local/apache/bin/apxs 是用来整合Apache
--with-libiconv-prefix=/usr/local/lib 是PHP的依赖库
Views: 473