vim /usr/local/apache2.4/conf/httpd.conf //修改以下4个地方ServerNameRequire all deniedAddType application/x-httpd-php .phpDirectoryIndex index.html index.php具体操作:1,打开这一行ServerName www.example.com:802,Require all denied改为Require all granted3,AddType application/x-compress .Z ????AddType application/x-gzip .gz .tgz ?????在上面两行下面加上这一行,不增加这一行php没办法解析 ?????AddType application/x-httpd-php .php4,DirectoryIndex index.html改为DirectoryIndex index.html index.php 增加一个索引页
测试语法
/usr/local/apache2.4/bin/apachectl -t
启动服务
/usr/local/apache2.4/bin/apachectl start ?netstat -lntp ?curl localhost
编辑测试的php文件
vim /usr/local/apache2.4/htodcs/test.php //增加如下内容<?phpecho 123;?>
curl测试
curl localhost/test.php
LAMP环境搭配之apache与php结合
原文地址:http://blog.51cto.com/chenshengsheng/2097368