I have read about 10 questions like this, but there seems to be no answer to this simple question.
What could cause .htm files to be downloading instead of executed as php?
I am using the following code:
AddType application/x-httpd-php htm
I have tried many combinations but no success.
What else can I try?
All I need is .htm and .html files to execute php.
In Apache and nginx ONLY work .htaccess
file:
<FilesMatch "\.html$">
SetHandler php-script
</FilesMatch>
I've also removed AddHandler
and AddType
from Apache conf (I used plesk).
Use AddHandler
also, change htm
to .htm
and add .html
AddHandler application/x-httpd-php .htm .html
AddType application/x-httpd-php .htm .html
http://www.suffix.be/blog/addhandler-addtype-directives
I had the same issue but then i figured the version of php i'm using is php5. I changed the handler to the following and it worked!
AddHandler x-httpd-php5-3 .php
AddHandler application/x-httpd-php5 .php
I had the same problem and couldn't find the answer here. Did find it on this cpanel forum though: https://forums.cpanel.net/threads/php-script-is-not-working-in-html-file.595195/
Their advice was to use this:
AddHandler application/x-httpd-ea-php56 .htm .html .shtml
AddType application/x-httpd-php5 .php
I was using PHP together with JSON though. After this PHP did work, but JSON didn't. Solved it by removing the AddType and sticking with the AddHandler
AddHandler application/x-httpd-ea-php56 .htm .html .shtml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With