cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/
mv /etc/rc.d/init.d/apachectl /etc/rc.d/init.d/httpd
chkconfig --add httpd #所有开机模式下自启动
chkconfig httpd on #345开机模式下自启动
安装php7
先解压(略)
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-xmlrpc --with-xsl --with-zlib --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip
出现“/replace/with/path/to/perl/interpreter: bad interpreter: No such file or
#vi /usr/local/apache/bin/apxs
第一行的#!/replace/with/path/to/perl/interpreter -w,找到你perl的安装位置,如果不清楚,可以用which perl找到,一般在/usr/bin/perl ,于是将第一行改为:#!/usr/bin/perl -w. 再运行php的configure, 一切正常!
make && make install
安装完成后打开httpd.conf 查找php7
看是否搜索到:LoadModule php7_module modules/libphp7.so
如果没有搜索到(一般都是可以搜索到的),就将这段指令添加到httpd.conf配置文件中,使apache可以加载libphp7.so模块,并进行php文件的解析。
:wq
进行保存退出。
cd /usr/local/apache/htdocs
按 i 键进入编辑模式,添加:
phpinfo();
?>
按Esc键回到命令模式,保存退出:
:wq