apache handler application/x-httpd-php5 not working
I have been using the .htaccess line for years:
AddType application/x-httpd-php5 .php .htm .html
to run .htm and .html files as .php. However, since migrating to easyapache 4 it doesn't work anymore. I have tried countless variations to get .htm, .html to execute and .php but to no avail. Any ideas? Running apache 2.4, PHP 5.6
-
AddType application/x-httpd-php5 .php .htm .html
Hello, With EasyApache 4, the entry should look like this (if you are using PHP 5.6):AddType application/x-httpd-ea-php56 .html .htm
Note that the entry for .php files is automatically configured as part of the MultiPHP functionality in EasyApache 4. EX:# php -- BEGIN cPanel-generated handler, do not edit # Set the "ea-php56" package as the default "PHP" programming language. AddType application/x-httpd-php .php .php5 .phtml # php -- END cPanel-generated handler, do not edit
Thus, you should not setup a custom MIME type for .php files if you want to ensure MultiPHP functionality works as expected. Thanks!0 -
The only way I could get it to work was with this line: AddType application/x-httpd-ea-php56 .html .htm OR AddHandler application/x-httpd-ea-php56 .html .htm I have PHP 5.5, 5.6, 7.1 installed and am using 5.6 on the particular site in question. I'm not sure which is the best way to go. 0 -
AddType application/x-httpd-ea-php56 .html .htm
This is the correct syntax if you are using PHP 5.6. It's also the same value used by another user on the following post: PHP Script is not working in .html file Thank you.0 -
When do I use AddType or AddHandler? Both seem to work. Will AddType application/x-httpd-ea-php71 .html .htm work for PHP 7.1? What shows all the MIME types on a server? 0 -
Hello, The AddType directive maps the given filename extensions onto the specified content type and the AddHandler directive maps the filename extensions to a specific handler (e.g. application/x-httpd-ea-php56). You can read more about how Mod_Mime works at: mod_mime - Apache HTTP Server Version 2.4 Will AddType application/x-httpd-ea-php71 .html .htm work for PHP 7.1?
Yes, it will work the same way it would for PHP 5.6 as long as PHP 7.1 is installed on the server.What shows all the MIME types on a server?
You can see a list of all MIME type by viewing the /etc/mime.types file:cat /etc/mime.types
Thank you.0
Please sign in to leave a comment.
Comments
5 comments