gcc
yum install gcc
#libxml2
yum install libxml2-devel
#添加用户
useradd -s /sbin/nologin php-fpm
#打开src目录
cd /usr/local/src
#下载安装包
wget https://www.php.net/distributions/php-7.2.3.tar.gz
cd php-7.2.3
./configure --prefix=/usr/local/php --sysconfdir=/usr/local/php/etc --with-config-file-path=/usr/local/php/etc/ --with-fpm-user=php-fpm --with-fpm-group=php-fpm --enable-fpm --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --enable-calendar --with-curl --with-gd --with-pgsql --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-pcre-regex --with-pdo-mysql --with-mysqli --with-jpeg-dir=/usr --with-png-dir=/usr --with-openssl --with-libdir=/lib/x86_64-linux-gnu/ --enable-ftp --with-gettext --with-xmlrpc --with-xsl --enable-opcache --with-iconv --with-xpm-dir=/usr
#开始安装
make -j 4 && make install
#复制配置文件和php-fpm
cp php.ini-production /usr/local/php/etc/php.ini
cp /usr/src/php-7.2.3/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
#移动配置文件
mv /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
#复制配置文件
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
#授权
chmod 755 /etc/init.d/php-fpm
chkconfig --add php-fpm
#因为上面php5已经用了9000端口,需要修改监听的端口
vim /usr/local/php/etc/php-fpm.d/www.conf
listen 9000 改为 listen 9072
wq!保存
#启动服务
service php-fpm start
chkconfig php-fpm on
php72做软连接
ln -s /usr/local/php/bin/php /usr/sbin/php
查看php版本号
php -v