1.安装apacheyum install apache -y
2.安装依赖yum install httpd yum install httpd-devel
3.查看apsx 所在路径rpm -ql httpd-devel|grep apxs /usr/bin/apxs //此行为 grep 结果,不同系统的路径可能不同,以实际结果为准,下同 /sur/share/man/man1/apxs.1.gz
4.编译php时,加入 apxs 路径参数./configure
--with-apxs2=/usr/bin/apxs
//安装
make && make install
5.修改配置文件vim /etc/httpd/conf/httpd.conf
//在LoadModule后面添加:
LoadModule php5_module modules/libphp5.so //不添加则访问.php文件将会变成下载
//在DirectoryIndex后面添加:
index.php
//在AddType application/x-gzip .gz .tgz后面添加:
AddType application/x-httpd-php .php //.php前面有一个空格
6.常用命令设置开机启动:systemctl enable httpd.service
启动服务: systemctl start httpd.service
停止服务: systemctl stop httpd.service
重启服务: systemctl reload httpd.service