groupadd www
useradd -g www -s /sbin/nologin -M www
yum install -y freetype-devel libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg libjpeg-devel libpng libpng-devel
./configure --prefix=/usr/local/PHP --with-config-file-path=/usr/local/PHP/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-MysqL=MysqLnd --with-MysqLi=MysqLnd --with-pdo-MysqL=MysqLnd --enable-opcache --enable-sockets --enable-xml --enable-mbstring --enable-soap --enable-zip --enable-bcmath --with-gettext --with-openssl --with-zlib --with-curl --with-gd --with-freetype-dir=/usr/include/freetype2/ --with-zlib-dir=/usr/lib --with-png-dir=/usr/lib --with-jpeg-dir=/usr/lib --with-mhash --with-apxs2=/usr/local/apache/bin/apxs
make
make install
cp PHP.ini-development /usr/local/PHP/etc/PHP.ini
cp /usr/local/PHP/etc/PHP-fpm.conf.default /usr/local/PHP/etc/PHP-fpm.conf
cp sapi/fpm/init.d.PHP-fpm /etc/init.d/PHP-fpm
chmod +x /etc/init.d/PHP-fpm
chkconfig --add PHP-fpm
service PHP-fpm start
service PHP-fpm restart
vim ~/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/PHP/bin
~/.bash_profile
PHP -v
原文链接:https://www.f2er.com/centos/379579.html