← ServerPilot Docs

How to Recompile PECL Extensions

You only need to recompile PECL extensions if you've upgraded Ubuntu.

PECL extensions are third-party extensions for PHP. These extensions often add new built-in functions to PHP that do not exist in the core PHP language. PECL extensions are often used to provide a way for PHP code to interact with additional system libraries.

PECL extensions need to be recompiled if libraries used by the extension have changed in a way that is not backwards compatible.

The only time your server's libraries will undergo a backwards incompatible change is when you upgrade Ubuntu to a new major version (for example, Ubuntu 20.04 to 22.04). In contrast, daily automatic updates do not include breaking changes and do not require you to recompile PECL extensions.

List the Installed PECL Extensions

To list the installed PECL extensions for a particular PHP version, SSH into your server and run the following command.

Replace X.Y in the command below with the PHP version.
peclX.Y list

For example, to list installed PECL extensions for PHP 8.3, use this command:

pecl8.3 list

If the output of the command is "(no packages installed from channel pecl.php.net)", then there are no PECL extensions installed for that PHP version.

To find all PECL extensions installed on your server, repeat the peclX.Y list command for each PHP version on your server.

Recompile a PECL Extension

Recompiling a PECL extension involves three steps:

  1. Remove the extension's binary file
  2. Compile the extension's binary file
  3. Restart PHP-FPM

You do not need to add or remove the PECL extension's PHP configuration. You should ignore all messages about php.ini when recompiling PECL extensions.

To recompile a PECL extension for a particular PHP version, SSH into your server and run the following commands.

Replace X.Y in the command below with the PHP version.
Replace EXTENSION in the command below with the package name shown in the output of peclX.Y list.
peclX.Y-sp uninstall EXTENSION
peclX.Y-sp install EXTENSION
service phpX.Y-fpm-sp restart

PECL extensions may ask configuration questions during the installation. When promoted with configuration questions, you can accept the suggested default by pressing ENTER.

If you encounter problems re-installing an extension, check our documentation for information about that extension or contact support.

Last updated: November 20, 2023

Launch your first site in 5 minutes