安装PHP

cd /usr/local/src/
useradd -s /sbin/nologin php

wget http://cn2.php.net/distributions/php-5.6.30.tar.gz
tar xf php-5.6.30.tar.gz
cd php-5.6.30
yum install -y gcc gcc-c++ libxml2-devel openssl-devel libcurl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=php --with-fpm-group=php --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --with-pear --with-curl --with-openssl
make && make install
cp php.ini-production /usr/local/php/etc/php.ini
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
vim /usr/local/php/etc/php-fpm.conf   
# 参考:https://coding.net/u/aminglinux/p/aminglinux-book/git/blob/master/D15Z/php-fpm.conf
chmod 755 /etc/init.d/php-fpm 
chkconfig --add php-fpm
chkconfig php-fpm on
service php-fpm start

    

原文地址:https://www.cnblogs.com/pzk7788/p/10330904.html