天天看点

出现访问apache资源直接下载php文件的解决办法-----yum 安装 php mysql

检查apache下模块扩展

yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml 

yum install mysql mysql-server mysql-devel

修改apache配置文件加上如下二行

AddType application/x-httpd-php .php .phtml

AddType application/x-httpd-php-source .phps

重启apache

注意:2.4.2版本的apache中需要在目录下面添加 Require all granted,否则无论怎么访问都是403

<VirtualHost *:80>

   ServerName www.test.com

   ServerAlias test.com

   DocumentRoot /application/apache/htdocs

   <Directory /application/apache/htdocs>

     Options +indexes

     Order allow,deny

     Allow from all

     Require all granted

    </Directory>

</VirtualHost>

本文转自cloves 51CTO博客,原文链接:http://blog.51cto.com/yeqing/1735524