AddHandler php with easyapache 4

I’ve recently been upgrading WHM/Cpanel web servers to use easyapache 4.  Amongst many benefits are ease of updates (it now uses rpms) and multiple php versions selectable by clients using multi php manager.

One client reported an issue as they are using an htaccess directive to parse html files as php.  Previously they were using:

AddHandler application/x-httpd-php5 .html

But this was no longer working…

After some google searching it turns out that handlers now use an easyapache specific format:

AddType application/x-httpd-ea-php54 .html

In cpanel, multiphp manager will add the following for force a specific
version of php:

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php54” package as the default “PHP” programming language.
<IfModule mime_module>
  AddType application/x-httpd-ea-php54 .php .php5 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

Make sure the AddType and the selected php version matches!  So there we go, simple when you know how.

Leave a Reply

Your e-mail address will not be published. Required fields are marked *