1.停掉服务

systemctl stop php-fpm

2.备份原有数据php7.2,下载新php7.3

cd /data
wget https://www.php.net/distributions/php-7.3.7.tar.gz
tar -czf phpbak7.2.gz php

3.解压

 tar xf php-7.3.7.tar.gz

4.编译安装
若忘记以前的编译参数,上次安装后没有make clean的话可以查看 config.nice

./configure --prefix=/data/php --with-curl --with-freetype-dir --with-gd --with-gettext --with-ldap--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-jpeg-dir --with-xmlrpc  --with-xsl --with-zlib --with-bz2  --with-mhash --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-sysvshm --enable-xml --enable-zip
  • 报错1
checking for pkg-config... (cached) /usr/bin/pkg-config
checking for libzip... not found
configure: error: Please reinstall the libzip distribution

libzip 的版本太低,需升级 libzip 版本

 wget https://libzip.org/download/libzip-1.3.2.tar.gz
 tar xf libzip-1.3.2.tar.gz 
 cd libzip-1.3.2/ 
 ./configure 
make && make install

再执行

./configure --pr
  • 报错2
configure: error: off_t undefined; check your library configuration

解决

vim /etc/ld.so.conf 
#添加如下几行
/usr/local/lib64
/usr/local/lib
/usr/lib
/usr/lib64 

#保存退出

ldconfig -v # 使之生效

再执行

./configure --pr

make && make install

5.启动php服务

systemctl start php-fpm
最后修改:2020 年 08 月 17 日 02 : 10 PM
如果觉得我的文章对你有用,请随意赞赏