How Can We Help?
< All Topics
Print

Guide to Installing Additional PHP Modules Using PECL

In our panel, we provide the option to enable PHP modules that are not listed in the GUI.
For instructions on activating PHP modules that are available within the GUI, please refer documentation.

This document outlines the steps for installing PHP modules that are not mentioned in the GUI, including third-party modules.

Installing Third-Party PHP Modules Using PECL

For third-party PHP modules not listed in the GUI, clients can still install them manually using PECL (PHP Extension Community Library). PECL is a repository for PHP extensions that provide additional functionality to PHP, such as performance enhancements, database drivers, and more.
PECL is already pre-installed on your server as part of our latest update. No additional setup is required. Follow the steps below to install any PHP extension that is not listed in the GUI.

Steps to Install a PECL Extension

1. Access the Server via SSH

Use an SSH client (e.g., PuTTY or terminal) to log in to your server.
We are using the latest PHP version, 8.4, as an example. The PECL path varies for each PHP version, make sure to modify the command to match the version of PHP you are using.

2. List installed PECL extensions

/opt/cpguard/packages/php84/bin/pecl list

3. Install the Required Extension

Run the following command, replacing EXTENSION with the name of the PHP extension you wish to install:

/opt/cpguard/packages/php84/bin/pecl install EXTENSION

Note: Ensure to replace the PHP version with the appropriate one as needed.

Example: /opt/cpguard/packages/php84/bin/pecl install imagick

4. Configure PHP to Load the Extension

After the extension is installed, configure PHP to load it by creating a new EXTENSION.ini file in the conf.d directory:

sudo bash -c "echo extension=EXTENSION.so > /opt/cpguard/packages/php84/etc/conf.d/EXTENSION.ini"

Example:

sudo bash -c “echo extension=EXTENSION.so > /etc/php7.2-sp/conf.d/imagick.ini”

sudo bash -c "echo extension=redis.so > /opt/cpguard/packages/php84/etc/conf.d/redis.ini"

4. Restart PHP-FPM

To apply the changes, restart PHP-FPM:

sudo service php84-fpm restart

Remove a PECL extensions

If you no longer need an extension you’ve installed, you can remove the extensions.

/opt/cpguard/packages/php84/bin/pecl uninstall EXTENSION

Example:
/opt/cpguard/packages/php84/bin/pecl uninstall imagick

To apply the changes, restart PHP-FPM:

sudo service php84-fpm restart 
Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.
Table of Contents