Enabling PHP Execution in HTML Files with EasyApache 4

thumb_up 1  ·  sell EasyApache 4 PHP in HTML, Running PHP code within HTML, Configuring PHP execution in EasyApache 4

A few days ago one of our techs was facing a strange issue while trying to execute PHP in HTML on EasyApache 4 from cPanel. After upgrading to EA4, a previously working .htaccess hack that was used to execute PHP in HTML was no longer working. This was the rule we used for our customer:

AddHandler application/x-httpd-php5 .html

Tried several things, even a simple test.html file with this content inside, and it was not executed ok:

<html>
<head></head>
<body>
Hello, today is <?php echo date('l, F jS, Y'); ?>.
</body>
</html>

While using EasyApache 3 it was working, but not on EA4. EA4 was built with latest version of Apache 2.4 with PHP 5.5, 5.6, 7.0 and 7.1. The file was not prompting to download the file, it was just not executing any php code at all and was displaying only the HTML code.

How can I Execute PHP in HTML on EasyApache 4?

EasyApache 4 introduced many important changes in the way cPanel handles Apache and PHP modules managemnet. One of them is the way EA4 manages PHP, right now thanks to the introduction of MultiPHP, the old hack to execute PHP in HTML no longer works because the PHP interpreter is different.

The way to execute PHP in HTML on EasyApache 4 is using the new PHP handlers that are coming with MultiPHP from cPanel. In this case, the site was using PHP 5.6, and this was the code that did work on the .htaccess file:

AddHandler application/x-httpd-ea-php55 .html

The End! should you have any inquiries, we encourage you to reach out to the Vercaa Support Center without hesitation.

Was this answer helpful?

Related Articles

description

Enabling Global Gzip Compression in WHM for All Accounts and Websites

Apache mod_deflate module is one of the best friends of a cPanel system administrator. It allows you to save bandwidth and accelerate page…

arrow_forward
description

Validating and Confirming cPanel License Information

cPanel and WHM is the #1 leading control panel in the web hosting market. And time ago we posted a post about how to get a free cpanel…

arrow_forward
description

Changing SSH Port via WHM for Enhanced Security

This is a new way I found to reset ssh port from WHM control panel if you ever lost SSH access because you forgot what is the port you are…

arrow_forward
description

Essential Nginx Modules for cPanel and WHM: Top 4 Picks

As we all know, cPanel doesn’t fully support Nginx yet, it will be ready in the future as it is one of the most requested features from…

arrow_forward
description

A Guide to Utilizing the MultiPHP INI Editor in cPanel

With the new EasyApache 4 we have a new option called MultiPHP INI Editor. It’s a simple PHP editor for WHM users who need to change PHP…

arrow_forward
arrow_back « Back