在/etc/apache2/apache2.conf文件中添加下面两行即可:
AddHandler php5-script .php .html
AddType text/html .php .html
保存后重启apache2: