安装PHP7
下载PHP7
[root@shuai-01 src]# wget http://cn2.php.net/distributions/php-7.1.6.tar.bz2
解压缩:
进入PHP7源码包下,编译安装
./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
[root@shuai-01 php-7.1.6]# echo $?
0
–with-apxs2=/usr/local/apache2.4/bin/apxs 在Apache上做支持的
接着make
[root@shuai-01 php-7.1.6]# echo $?
0
make install
把PHP7配置文件拷贝到指定路径下
查看Apache加载的PHP模块:
[root@shuai-01 php-7.1.6]# /usr/local/apache2.4/bin/apachectl -M
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::4f59:7251:18f1:8716. Set the 'ServerName' directive globally to suppress this message
Loaded Modules:
core_module (static)
so_module (static)
http_module (static)
mpm_event_module (static)
authn_file_module (shared)
authn_core_module (shared)
authz_host_module (shared)
authz_groupfile_module (shared)
authz_user_module (shared)
authz_core_module (shared)
access_compat_module (shared)
auth_basic_module (shared)
reqtimeout_module (shared)
filter_module (shared)
mime_module (shared)
log_config_module (shared)
env_module (shared)
headers_module (shared)
setenvif_module (shared)
version_module (shared)
unixd_module (shared)
status_module (shared)
autoindex_module (shared)
dir_module (shared)
alias_module (shared)
php5_module (shared)
php7_module (shared)
查看Apache的配置文件(/usr/local/apache2.4/conf/httpd.conf)
[root@shuai-01 php-7.1.6]# vim /usr/local/apache2.4/conf/httpd.conf
LoadModule dir_module modules/mod_dir.so
#LoadModule actions_module modules/mod_actions.so
#LoadModule speling_module modules/mod_speling.so
#LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
#LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module modules/libphp5.so
LoadModule php7_module modules/libphp7.so
Apache中两PHP模块,只能使用一个,另一个要注释掉