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