天天看点

Apache结合php

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 //这个打开

本文转自 虾米的春天 51CTO博客,原文链接:http://blog.51cto.com/lsxme/2051890,如需转载请自行联系原作者