cd /usr/local/src/
wget http://cn2.php.net/distributions/php-7.1.6.tar.bz2
tar jxvf php-7.1.6.tar.bz2
cd /usr/local/src/php-7.1.6/
./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php7/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 /usr/local/src/php-7.1.6/php.ini-production /usr/local/php7/etc/php.ini
如果安装了php5后又安装了php7,那么调用Apache调用只能用其中一个;
那么就需要修改配置文件
vim /usr/local/apache2.4/conf/httpd.conf
不想要php5就注释掉LoadModule php5_module modules/libphp5.so
不想要php7就注释掉LoadModule php7_module modules/libphp7.so
/usr/local/apache2.4/bin/apachectl -M
原文地址:http://blog.51cto.com/shuzonglu/2074077