安装PHP:5.6 (源码包方式)
cd /usr/local/src
wget http://
tar zxvf php-5.6.32.tar.gz
cd php-5.6.32
#先确保已安装:openssl-devel;libxml2-devel;bzip2-devel;libjpeg-turbo-devel;libpng-devel;freetype-devel;epel-release;php-mcrypt;libmcrypt-devel 这几个包
注意:安装php7时,不用添加--with-mysql=/usr/local/mysql/;其他不变
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/httpd/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql/ --with-pdo-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir -with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif
make && make install
cp php.ini-production /usr/local/php/etc/php.ini
/usr/local/php/bin/php -m #查看加载的模块
/usr/local/httpd/bin/httpd -M #查看apache是否已加载php模块