Knowledge Base Hub

Browse through our helpful how-to guides to get the fastest solutions to your technical issues.

Home  >  cPanel  >  How to Install Multiple PHP Extensions using PECL via SSH?
Top Scroll

How to Install Multiple PHP Extensions using PECL via SSH?

 2 min

When doing PHP configurations to Linux hosting, you may have to install PHP extensions for all versions. To do that, you will have to run the installer for each individual version.

To Install a PHP Extension

1. Install a PHP module by running the pecl command:

/opt/cpanel/ea-php72/root/usr/bin/pecl
/opt/cpanel/ea-php73/root/usr/bin/pecl

EasyApache 4 offers multiple versions of PHP. The command for each PHP version is different as shown in the above example with the PECL location for PHP 7.2 and PHP 7.3.

2. Install a module using the pecl install command:

/opt/cpanel/ea-php73/root/usr/bin/pecl install xmldiff

To Install Multiple PHP Extensions

Loop through each PHP version and run the installer with the command:

ls /opt/cpanel/ea-php{72..80}/root/usr/bin/pecl 2>/dev/null | while read phpversion; do $phpversion install xmldiff; done

The code you see above is to loop through PHP versions from 72 through 80 while installing xmldiff for each of them.

You can take that as an example to install a single PHP extension or multiple PHP extensions at once using PECL on a Linux server.

For our Knowledge Base visitors only
Get 10% OFF on Hosting
Special Offer!
30
MINS
59
SECS
Claim the discount before it’s too late. Use the coupon code:
STORYSAVER
Note: Copy the coupon code and apply it on checkout.