配置阿里云源:

1
2
3
4
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

yum clean
yum makecache

安装依赖:

1
yum install gcc libxml2-devel openssl-devel

安装 PHP:

1
2
3
4
5
6
7
8
9
10
11
wget https://www.php.net/distributions/php-7.2.30.tar.gz

tar -zxf php-7.2.30.tar.gz
cd php-7.2.30

./configure --prefix=/usr/local/php72/ --enable-fpm --with-pdo-mysql --with-openssl --with-zlib --enable-mbstring --with-config-file-path=/usr/local/php72/etc/

make
make install

cp php.ini-development /usr/local/php72/etc/php.ini