centos中安装php7.3.13(目前最新版)

安装步骤如下:

[root@node3 /]# yum -y install gcc-c++ libxml2-devel curl-devel libjpeg-devel libpng-devel freetype-devel
[root@node3 /]# cd /usr/apps/

[root@node3 apps]# wget -c https://www.php.net/distributions/php-5.6.27.tar.gz
[root@node3 apps]# wget -c https://www.php.net/distributions/php-7.3.13.tar.gz # 用这个版本

[root@node3 apps]# wget -c https://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
[root@node3 apps]# tar -zxvf php-5.6.27.tar.gz -C /usr/develop/
[root@node3 apps]# tar -zxvf libmcrypt-2.5.8.tar.gz -C /usr/develop/
[root@node3 apps]# cd /usr/develop/
[root@node3 develop]# cd libmcrypt-2.5.8/
[root@node3 libmcrypt-2.5.8]# ./configure 
[root@node3 libmcrypt-2.5.8]# make && make install
[root@node3 libmcrypt-2.5.8]# cd ../php-7.3.13/
[root@node3 php-7.3.13]# ./configure --prefix=/usr/local/php --enable-fpm --with-zlib --enable-zip --enable-mbstring --with-mcrypt --with-mysql --with-mysqli --with-pdo-mysql --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-curl --with-openssl --with-mhash --enable-bcmath --enable-opcache
[root@node3 php-7.3.13]# make && make install

php执行配置命令configure时,报错1:

checking for libzip... not found
configure: error: Please reinstall the libzip distribution

缺少libzip,下载并安装之:

wget -c https://libzip.org/download/libzip-1.6.1.tar.gz
[root@node3 apps]# tar -zxvf libzip-1.6.1.tar.gz -C /usr/develop/
[root@node3 apps]# cd ../develop/libzip-1.6.1/
[root@node3 libzip-1.6.1]# mkdir build
[root@node3 libzip-1.6.1]# cd build
[root@node3 build]# yum -y install cmake #如果提示cmake不存在或版本过低,则需要重新安装cmake
[root@node3 build]# cmake ..
[root@node3 build]# make && make install

再次执行./configure命令

报错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 
#保存退出
:wq
ldconfig -v # 使之生效

再次执行./configure命令
警告:configure: WARNING: unrecognized options: --with-mcrypt, --with-mysql ,暂时不管它
执行make命令
[root@node3 php-7.3.13]# make && make install
安装php7.3.13成功!

原文地址:https://www.cnblogs.com/mediocreWorld/p/15188401.html