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.

Step 1. Login into WHM as root

whm-root-login

Step 2. Type 'easy' into the search field in the top left of WHM.

whm-search-easy

Step 3. Under the Software category, click on EasyApache 4.

whm-easyapache-4-menu-option

Step 4. In the Currently Installed Packages section, click on the Customize button.

ea4-currently-installed-package-customize-button

Step 5. Click on the PHP Extensions option from the left.

ea4-php-extensions-option

Step 6. In the Search field, type to enter 'fileinfo'.

ea4-php-extensions-search-field-fileinfo

Step 7. Click the toggle button(s) next to the PHP version(s) that you would like the PHP extension installed for.

ea4-php-extensions-toggle-selections

Step 8. Click the Review option from the left.

ea4-review-option

Step 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-php-extensions

Step 10. Once the installation is completed, you will receive a message: "The provision process is complete". Click the Done button to finish.

ea4-provision-process-complete-done-button

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.

Step 1. Connect to your server via an SSH connection.

Step 2. First, update cPanel by running the following command:

/scripts/upcp

Step 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:

root@localhost ~ $ 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.

 

SOURCE LINK FROM : https://www.inmotionhosting.com/support/edu/easyapache/easy-apache-4/how-to-install-a-php-extension-using-easyapache-4

 

Related Articles

Comments