1、安装依赖
yum install -y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
2、下载源码包
wget http://cn2.php.net/get/php-7.3.2.tar.gz/from/this/mirror
根据自己需求,下载相应的版本,这里选择7.3.2版本
3、解压源码包
tar -xzvf php-7.3.2.tar.gz
进入解压后的目录
cd php-7.3.2
4、预编译
./configure –prefix=/usr/local/php –exec-prefix=/usr/local/php –with-mysqli –with-pdo-mysql –with-gd –bindir=/usr/local/php/bin –sbindir=/usr/local/php/sbin –includedir=/usr/local/php/include –libdir=/usr/local/php/lib/php –mandir=/usr/local/php/php/man –with-config-file-path=/usr/local/php/etc –with-opens