1

I'm running Apache 2.4.41 and PHP 8.1.6 as FPM on Ubuntu. I had PHP as Apache module but since mod_php doesn't support http/2 I disabled it and installed PHP-FPM.

On my server PHP code is included in some .html files and I've used AddType application/x-httpd-php .html .htm to also process .html files like .php files, but with PHP-FPM this doesn't work anymore.

If I continue to use AddType application/x-httpd-php .html .htm, .html files are offered to the client for download, but the PHP code itself is not processed. So I tried security.limit_extensions in php.ini file but that has no effect. Does anyone know how Apache + PHP-FPM can also process .html files like .php files?

Karl Heinz
  • 21
  • 1
  • Does this answer your question? [Apache 2.4 + PHP-FPM and Authorization headers](https://stackoverflow.com/questions/17018586/apache-2-4-php-fpm-and-authorization-headers) – Atilla Arda Açıkgöz May 20 '22 at 11:14

1 Answers1

0

AddType maps the file extensions to the content type

https://httpd.apache.org/docs/2.2/mod/mod_mime.html#addtype

AddType application/x-httpd-php .htm .html

Than there is AddHandler which maps it to the handler itself

https://httpd.apache.org/docs/2.2/mod/mod_mime.html#addhandler

AddHandler application/x-httpd-php .html

Also if you're working with PHP+FPM you need to adjust it too. And here you find a good walkthrough how to do it:

https://support.plesk.com/hc/en-us/articles/115000781549-How-to-configure-Apache-to-process-PHP-code-inside-an-html-file-on-a-Plesk-server

Thorsten Wolske
  • 424
  • 4
  • 9