天天看點

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,如需轉載請自行聯系原作者