On my server, I am using nginx with php5-fpm (not Apache).
All the HTML, JavaScript and php code in my index.php file runs fine. But if I rename the file to index.html, the embedded php code doesn't execute. (All the HTML and JavaScript code continue to work fine.)
Several answers recommend adding the line
AddType application/x-httpd-php5 .html .htm
to the .htaccess
file, but after downloading, installing and configuring nginx and php5-fpm, there was no .htaccess
file on my server. So I created one, pasted the above line and placed the file in the website's root directory along with index.html
. I restarted nginx, but the php code still does not work. (To be absolutely sure, I simply changed the file extension from html to php and everything is perfect.)
When I use firebug on the rendered page in my browser, the php tag and code don't appear to be there.