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.
Type ‘easy‘ into the search field in the top left of WHM.
Under the Software category, click on EasyApache 4.
In the Currently Installed Packages section, click on the Customize button.
Click on the PHP Extensions option from the left.
In the Search field, type to enter ‘fileinfo‘.
Click the toggle button(s) next to the PHP version(s) that you would like the PHP extension installed for.
Click the Review option from the left.
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.
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.
First, update cPanel by running the following command:
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’
root@localhost ~ $ scl enable ea-php56 ‘php -i’ | grep ‘fileinfo’
Configure Command => ‘./configure’ …’–enable-fileinfo=shared’…’
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.