How to Install a PHP Extension Using EasyApache 4

Install a PHP Extension Using EasyApache4

If you’re looking to install a PHP extension on your PHP web hosting, EasyApache 4 (EA4) offers a seamless solution. It simplifies the management of PHP extensions compared to EasyApache 3 (EA3). In this article, we will guide you through the process of installing the fileinfo PHP extension using EasyApache 4. You can easily follow the steps provided via your Web Host Manager (WHM) or Command Line Interface (CLI). Make sure to upgrade to EasyApache 4 for a smoother experience in managing PHP extensions.

If you are using AlmaLinux 8, then only the following versions of PHP are available through EasyApache 4:

  • PHP 7.2
  • PHP 7.3
  • PHP 7.4
  • PHP 8.0
  • PHP 8.1

The following versions will not be available when using AlmaLinux 8.

  • PHP 5.4
  • PHP 5.5
  • PHP 5.6
  • PHP 7.0
  • PHP 7.1

In order to see the most recent versions available, you can run the following command:

repoquery --repoid=EA4 --queryformat="%{name}" | grep -Eoh "ea-php[0-9]{2}" | sort | uniq

AlmaLinux 8 does not provide support for loading the legacy versions of PHP (pre-version 7.2). Support for these earlier versions can loaded using CentOS.

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:

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

Available PHP Extensions

Below is a list of PHP extensions for PHP 8. Available extensions will vary depending on your installed PHP version(s).

  • build – package shipping basic build configuration
  • libc-client – UW C-client mail library
  • libc-client-devel – development tools for programs which will use the UW IMAP library
  • libc-client-static – UW IMAP static library
  • pear – PHP Extension and Application Repository framework
  • php – PHP DSO
  • php-bcmath – module for PHP applications for using the bcmath library
  • php-bz2 – module for PHP applications that interface with .bz2 files
  • php-calendar – module for PHP applications that need date/time calculations
  • php-cli – CLI for PHP
  • php-common – common files for PHP
  • php-curl – module for PHP applications that need to interface with curl
  • php-dba – database abstraction layer module for PHP applications
  • php-dbg – interactive PHP debugger
  • php-devel – files needed for building PHP extensions
  • php-enchant – Enchant spelling extension for PHP applications
  • php-exif – module for PHP applications that need to work with image metadata
  • php-fileinfo – module for PHP applications that need to detect file types
  • php-fpm – PHP FastCGI Process Manager
  • php-ftp – module for PHP applications that need full FTP protocol support
  • php-gd – module for PHP applications for using the gd graphics library
  • php-gettext – module for PHP applications that need native language support
  • php-gmp – module for PHP applications for using the GNU MP library
  • php-iconv – module for PHP applications that need to convert character sets
  • php-imagick – native php extension to create and modify images using the ImageMagick API
  • php-imap – module for PHP applications that use IMAP
  • php-intl – internationalization extension for PHP applications
  • php-ldap – module for PHP applications that use LDAP
  • php-libsodium – modern, easy-to-use software library for encryption, decryption, signatures, password hashing and more. Its goal is to provide all of the core operations needed to build higher-level cryptographic tools
  • php-litespeed – LiteSpeed web server PHP support
  • php-mbstring – module for PHP applications which need multi-byte string handling
  • php-memcached – php-memcached extension for ea-php80
  • php-mysqlnd – module for PHP applications that use MySQL databases
  • php-odbc – module for PHP applications that use ODBC databases
  • php-opcache – Zend OPcache
  • php-pdo – database access abstraction module for PHP applications
  • php-pgsql – PostgreSQL database module for PHP
  • php-posix – modules for PHP scripts that need access to POSIX functions
  • php-process – modules for PHP script using system process interfaces
  • php-pspell – module for PHP applications for using pspell interfaces
  • php-redis – PHP extension for interfacing with Redis
  • php-snmp – module for PHP applications that query SNMP-managed devices
  • php-soap – module for PHP applications that use the SOAP protocol
  • php-sockets – module for PHP applications that need low-level access to sockets
  • php-sodium – cryptographic extension based on Libsodium
  • php-sourceguardian – loader for SourceGuardian-encoded PHP files
  • php-tidy – standard PHP module provides tidy library support
  • php-xml – module for PHP applications which use XML
  • php-zip – module for PHP applications that need to handle .zip files
  • runtime – package that handles ea-php80 Software Collection
  • scldevel – package shipping development files for ea-php80

You can view the documented PHP extensions list at PHP.net.

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.

IC
InMotion Hosting Contributor Content Writer II

InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

More Articles by InMotion Hosting

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

Was this article helpful? Join the conversation!

Questions about our MailChannels Deployment? We have answers and are here to help!Learn More
+