lamp访问的时候index.php时直接下载了该文件

这个原因是因为Apache无法解析php文件

vim /etc/httpd/httpd.conf

addType application/x-httpd-php .php

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


<IfModule dir_module>

    DirectoryIndex  index.php index.html

</IfModule>