您的位置:首页 > 运维架构 > Apache

Apache结合php

2017-12-18 21:29 183 查看
httpd主配置文件/usr/local/apache2.4/conf/httpd.conf
vim /usr/local/apache2.4/conf/httpd.conf //修改以下4个地方
ServerName(前面#去掉)
Require all denied //改成Require all granted(防止打开虚拟主机配置文件时显示403)
AddType application/x-httpd-php .php //解析php
DirectoryIndex index.html index.php
/usr/local/apache2.4/bin/apachectl -t //测试语法
/usr/local/apache2/bin/apachectl graceful 重新加载配置文件,不会把进程杀掉
/usr/local/apache2.4/bin/apachectl start //启动服务
netstat -lntp
curl localhost
vim /usr/local/apache2.4/htodcs/test.php //增加如下内容
<?php
Phpinfo();
?>

问题!!

/usr/local/apache2.4/bin/apachectl restart
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
解决办法:
vi conf/httpd.conf
#ServerName www.example.com:80 //这个打开
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Apache 结合 php