cd /usr/local/src/ wget http://cn2.php.net/distributions/php-7.1.12.tar.gz tar xf php-7.1.12.tar.gz cd php-7.1.12 ./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php7/etc --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 ls /usr/local/apache2.4/modules/libphp7.so cp php.ini-production /usr/local/php7/etc/php.ini
/usr/local/php7/bin/php -m //查看加载的模块有哪些
/usr/local/apache2.4/bin/apachectl -M //查看Apache加载了几个php
一台机器可以安装两个php,但是Apache调用时要指定好。 设置方法: vi /usr/local/apache2.4/conf/httpd.conf //注释掉其一 LoadModule php5_module modules/libphp5.so LoadModule php7_module modules/libphp7.so