Wanting to use DDEV for local development, and I have a site with legacy content needing to run php on pages with .html extension. With other testing environments I have used different lines in .htaccess to enable this. With my ddev test environment I can't yet figure what works.
UPDATED Here are the lines I've tried (uncommenting singly or in combo) in .htaccess:
#AddType application/x-httpd-php .html .htm
#AddHandler application/x-httpd-php .htm .html
#AddType application/x-httpd-php7 .html .htm
#AddHandler application/x-httpd-php7 .htm .html
#AddHandler x-httpd-php .htm .html
#AddType x-httpd-php .html .htm
#AddType x-httpd-php7 .html .htm
#AddHandler x-httpd-php7 .htm .html
#AddType x-httpd-php73 .htm .html
#AddHandler x-httpd-php73.htm .html
#AddHandler x-httpd-php7-3 .htm .html
#AddType application/x-httpd-php73 .html .htm
#AddType application/x-httpd-php7-3 .html .htm
#AddHandler application/x-httpd-php7-3 .htm .html
I also tried updating the .ddev/apache/apache-site.conf with something like:
<FilesMatch ".html$">
SetHandler "proxy:fcgi://php:9000"
</FilesMatch>
or
<FilesMatch ".+\.html$">
SetHandler applicaiton/x-httpd-php
</FilesMatch>
but admittedly this is not something I'm familiar with so probably not getting those quite right.
macOS Big Sur, ddev1.16.5 with php7.3, ddev webserver_type: apache-fpm.
Any suggestions? Thanks!
The problem is that php-fpm is not configured to allow use of the .html file extension. This is configured in /etc/php/<version>/fpm/pool.d/www.conf.
So you have two things to do to enable the behavior you're after, allowing PHP interpretation of HTML files.
<FilesMatch ".+\.(html|ph(ar|p|tml))$">
SetHandler "proxy:unix:/var/run/php-fpm.sock|fcgi://localhost"
</FilesMatch>