I'm trying to move over to AWS EC2 and I've hit a sticking point. I've spent a full day trying every possible solution I could find on Stack Overflow and elsewhere, but to no avail.
I want to process .htm files as PHP files. Files ending in .php are processed just fine, but I can't get .htm files to be processed as PHP.
If I use this "AddHandler" syntax in .htaccess, nothing happens:
AddHandler application/x-httpd-php .htm
"x-httpd-php" can literally be anything. It doesn't matter. Even this does nothing:
AddHandler application/its-a-fish .htm
Using this "AddType" syntax, on the other hand, always causes the file to be downloaded by the browser instead of parsed as code:
AddType application/x-httpd-php .htm
Here again, what follows "application/" doesn't matter. All of these cause the file to be downloaded instead of processed:
AddType application/its-a-fish .htm
AddType application/x-http-php7 .htm
AddType application/x-http-php73 .htm
When the file is downloaded, the Content-Type in the Response header is whatever comes after "AddType" in .htaccess, e.g.:
Content-Type: application/x-http-php73
So maybe I just haven't found the "application" identifier my PHP is running under?
I've tried literally every code example I can find over a ~10-hour period (especially in these threads) but nothing has worked:
Server not parsing .html as PHP
http://kb.cloudblue.com/en/115773
I suspect the reason it worked on all my previous servers and not on AWS is because PHP is running as FastCGI on AWS, not an Apache Handler, but I can't figure out how to make it work with FastCGI.
Here are the relevant packages I currently I have installed:
[root@ip-172-31-30-111 etc]# rpm -qa | egrep 'http|php'
libnghttp2-1.31.1-1.amzn2.0.2.x86_64
httpd-tools-2.4.39-1.amzn2.0.1.x86_64
mod_http2-1.14.1-1.amzn2.x86_64
php-pdo-7.3.6-1.amzn2.0.1.x86_64
generic-logos-httpd-18.0.0-4.amzn2.noarch
httpd-filesystem-2.4.39-1.amzn2.0.1.noarch
httpd-2.4.39-1.amzn2.0.1.x86_64
php-json-7.3.6-1.amzn2.0.1.x86_64
php-mysqlnd-7.3.6-1.amzn2.0.1.x86_64
php-cli-7.3.6-1.amzn2.0.1.x86_64
php-common-7.3.6-1.amzn2.0.1.x86_64
php-fpm-7.3.6-1.amzn2.0.1.x86_64