Apache 2 解析html中的php

Ubuntu下安装Apache 2无法解析html中的php

Ubuntu下安装了Apache 2却无法解析html中的php ,好多说是在httpd.conf文件中修改代码,但是ubuntu中没有这个文件啊,新建添加代码之后,网页直接把html的代码给显示出来了……

其实一个可行的办法是,在/etc/apache2/apache2.conf文件中添加下面两行即可:

AddHandler php5-script .php .html

AddType text/html .php .html

保存后重启apache2:

sudo /etc/init.d/apache2 restart


 




原文地址:https://www.cnblogs.com/jins-note/p/9513119.html