How to Install a PHP Extension Using EasyApache 4

EasyApache 4 (EA4) makes managing PHP Extensions very simple. If you are currently using EasyApache 3 (EA3), you should upgrade to EasyApache 4. In this guide, you will learn the steps to install the fileinfo PHP extension using EasyApache 4 from your Web Host Manager (WHM) and Command Line Interface (CLI).

Install from WHM

EasyApache 4 is designed as a user-interface for the yum program to integrate into WHM. However, it is important to note that you need to install the PHP extension separately for each PHP version. The instructions below provide the steps to follow to install the PHP extension fileinfo (for PHP versions 5.5, 5.6, 7.0, and 7.1) using WHM.

  1. Log into WHM as root.
    WHM login screen, Username root, Password field filled, and Log in button highlighted
  2. Type ‘easy‘ into the search field in the top left of WHM.
    easy entered into WHM search field
  3. Under the Software category, click on EasyApache 4.
  4. In the Currently Installed Packages section, click on the Customize button.
    EA4 Currently Installed Packages Customize button highlighted
  5. Click on the PHP Extensions option from the left.
  6. In the Search field, type to enter ‘fileinfo‘.
    EA4 PHP Extensions Search field, fileinfo entered and highlighted
  7. Click the toggle button(s) next to the PHP version(s) that you would like the PHP extension installed for.
    PHP extension fileinfo for PHP version 5.5, 5.6, 7.0, and 7.1 selected and highlighted
  8. Click the Review option from the left.
  9. Confirm the options you selected are listed under the “Please review the following list of packages you are about to install by provisioning this profile.” section. Then, click the Provision button.
    EA4 Review section displaying the 'Please review the following list of packages you are about to install by provisioning this profile' section
  10. Once the installation is completed, you will receive a message: “The provision process is complete”. Click the Done button to finish.

Now that you have completed installing the fileinfo PHP extension from WHM, you can view your phpinfo.php page to confirm it is enabled.

Install from CLI

EasyApache 4 is also designed to allow installation of PHP extensions via the Command Line Interface (CLI) using Yellowdog Updater Modified (yum). Again, it is important to note that you need to install the PHP extension separately for each PHP version.

Also, EA4’s packages for PHP modules and extensions use the ea-php##-php-module naming convention. Simply replace ## with the PHP version number (for our example: ’55’, ’56’, ’70’, and ’71’) and module with the name of the PHP module/extension (‘fileinfo’ in our example). The steps below indicate how you can install the PHP extension fileinfo from the CLI using yum.

  1. Connect to your server via an SSH connection.
  2. First, update cPanel by running the following command:
    /scripts/upcp
  3. Once “upcp” completes, run the following command:
    yum install -y ea-php55-php-fileinfo ea-php56-php-fileinfo ea-php70-php-fileinfo ea-php71-php-fileinfo

Now that you have completed installing the fileinfo PHP extension from the CLI, you can confirm it is enabled by running the following command (replacing ## with the PHP version you want to check:

scl enable ea-php## 'php -i' | grep 'fileinfo'

For example:

[email protected] ~ $  scl enable ea-php56 'php -i' | grep 'fileinfo'
Configure Command => './configure' ...'--enable-fileinfo=shared'...'
/opt/cpanel/ea-php56/root/etc/php.d/fileinfo.ini,
fileinfo
fileinfo support => enabled

Now that you know how to install a PHP extension using EasyApache 4, you can continue to customize your server’s Apache/PHP environment. Installing other PHP extensions and Apache modules is generally done by following the same process. Be sure to check out our EasyApache Education Channel for more advanced guides.

JB
John-Paul Briones Content Writer II

John-Paul is an Electronics Engineer that spent most of his career in IT. He has been a Technical Writer for InMotion since 2013.

More Articles by John-Paul

Thoughts on “How to Install a PHP Extension Using EasyApache 4

Was this article helpful? Let us know!