wget http://cn2.php.net/distributions/php-7.1.6.tar.bz2
tar zxf php-7.1.6.tar.bz2
cd php-7.1.6
./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2.4/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/php7/etc/php.ini
# vim /usr/local/apache/htdocs/index1.php
<?php
echo "Hello World";
?>
# 去掉注释
# ServerName www.example.com:80
Require all denied
# 改成
Require all granted
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
# 两行下加入
AddType application/x-httpd-php .php
DirectoryIndex index.html
# 改为
DirectoryIndex index.html index.php
/usr/local/apache/bin/apachectl -t 检查配置文件语法错误
/usr/local/apache/bin/apachectl graceful 加载配置文件