Docs

How to add a PHP extension (redis, imagick, ioncube and more)

Install a PHP extension for one PHP version from the panel or over SSH with dnf or apt, check that it loads, restart PHP-FPM, and make heavy extensions optional per website.

How-to over SSH AlmaLinux, Rocky Linux, Ubuntu, Debian 2 min read Updated

intoPanel installs PHP as one set of packages per version, so an extension is installed per PHP version: adding redis for PHP 8.3 does not add it to PHP 8.2.

SystemPHP comes fromPackage namesSettings folder
AlmaLinux, Rocky LinuxThe Remi repositoryphp83-php-…, php74-php-…/etc/opt/remi/php83/
Ubuntu 22.04, 24.04The ondrej/php archivephp8.3-…, php7.4-…/etc/php/8.3/
Debian 12, 13The sury.org archivephp8.3-…, php7.4-…/etc/php/8.3/
Ubuntu 26.04Ubuntu itself (PHP 8.5 only)php8.5-…/etc/php/8.5/

Step 1: Find which PHP version the website uses#

In the admin area, Software → PHP Version per Domain lists every website with its PHP version. Over SSH, list the installed versions:

ls /opt/remi/ | grep -E '^php[0-9]+$'   # AlmaLinux, Rocky Linux
ls /etc/php/                            # Ubuntu, Debian

Open Software → PHP Versions, click Extensions next to the version, and click Install next to the extension. The panel offers bcmath, gd, intl, mbstring, soap, xml, opcache, mysqlnd, pgsql, ldap, imap, gmp, tidy, sodium, process, zip, imagick, redis, memcached, apcu, igbinary, mongodb, ssh2, yaml and, on AlmaLinux and Rocky Linux, ioncube-loader.

For any other package of the PHP source, type its name under Software → PHP Extensions → Install an extension, for example pecl-xdebug3 (on Ubuntu and Debian, xdebug). The package phpXY-php-NAME (on Ubuntu and Debian, phpX.Y-NAME) is installed and loaded for every website.

Step 3: Or install over SSH#

Search for the package for your version (here PHP 8.3), install it and restart that version's PHP-FPM.

On AlmaLinux and Rocky Linux:

dnf search php83-php- 2>/dev/null | grep -i redis
dnf -y install php83-php-pecl-redis6
systemctl restart php83-php-fpm

On Ubuntu and Debian:

apt-cache search php8.3- | grep -i redis
apt-get -y install php8.3-redis
systemctl restart php8.3-fpm

When Account Isolation is on, each account's PHP runs in a service of its own and loads the extension when that service next restarts. Installing from the panel (step 2) takes care of this for you, which is one more reason to prefer it.

Step 4: Check that it loads#

On AlmaLinux and Rocky Linux:

/opt/remi/php83/root/usr/bin/php -m | grep -i redis
/opt/remi/php83/root/usr/bin/php --ri redis | head -n 5

On Ubuntu and Debian:

php8.3 -m | grep -i redis
php8.3 --ri redis | head -n 5

The extension's settings file is in /etc/opt/remi/php83/php.d/ (on Ubuntu and Debian, /etc/php/8.3/fpm/conf.d/). To be sure a website sees it, create a file with <?php phpinfo(); in its folder, open it in a browser, search for the extension, and delete the file afterwards.

Step 5: Make heavy extensions optional#

Extensions like imagick, xdebug or ioncube-loader use memory in every PHP process. Under Software → PHP Extensions, choose the version and click Make optional: only the websites whose owner ticks the extension on their PHP Versions page will load it. This works with the PHP-FPM handler.

Common problems#

  • "No match for argument" (dnf) or "Unable to locate package" (apt): the extension does not exist for that PHP version (for example, an old PECL extension for PHP 8.5). Check the name with dnf search or apt-cache search.
  • Loaded on the command line, not on the website: PHP-FPM was not restarted, or the website uses another PHP version.
  • ionCube: the loader must match the PHP version exactly; install ioncube-loader for the version the website uses. The panel offers it as a package on AlmaLinux and Rocky Linux only.

Frequently asked questions

Where is php.ini for each PHP version?

For PHP 8.3 it is /etc/opt/remi/php83/php.ini, with extension files in /etc/opt/remi/php83/php.d/. On Ubuntu and Debian it is /etc/php/8.3/fpm/php.ini, with extension files in /etc/php/8.3/fpm/conf.d/. Change PHP settings in the admin area's php.ini editor or PHP settings pages, so the panel knows about them.

Can a client install extensions?

Clients cannot install packages, but they can tick optional extensions for their own websites on their PHP Versions page.

Why use a package such as php83-php-pecl-redis6 or php8.3-redis and not pecl install?

Packages from the PHP source are updated with the system and removed cleanly with their PHP version; extensions built by hand with pecl are not.

Was this article helpful?

Something missing? Ask in the community or open a ticket.