Apache版本2.4.6
PHP 版本7.0.27
首先确保php和apache已经正确安装
检查/etc/httpd/conf.modules.d/10-php.conf该文件是否存在,若apache页面只提示下载的话,该文件一般都不存在
检查/usr/lib64/httpd/modules/libphp7.so和/usr/lib64/httpd/modules/libphp7-zts.so是否存在
若上面三个文件都不存在,请拷贝上述三个文件至对应的目录,并赋755权限,可以从该路径下载:https://download.csdn.net/download/duoluocongci/10339427
在apache的配置文件中增加下面信息:
1)
<IfModule dir_module>
DirectoryIndex index.php index.html</IfModule>
2)
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
重启apache不报错,页面正常解析