(Plesk for Linux) Installing PHP Extensions from PECL
Inhalt: PHP extensions add features and capabilities to PHP handlers, or improve PHP performance. Certain PHP code may not be processed correctly by the handler unless one or more specific extensions are installed. Plesk comes with a number of most popular PHP extensions pre-installed.
In Plesk for Linux, you can also install PHP extensions in the form of packages available from PECL (PHP Extension Community Library) via both the graphical (GUI) and command line (CLI) interfaces.
In this topic, you will learn how to install, update, and uninstall PHP extensions from PECL in Plesk.
Prerequisites and Limitations
The ability to manage extensions from PECL in Plesk is only available for PHP handlers version 7.3 and later.
Bemerkung: PHP extensions in PECL are created and maintained by third parties. They are not created, maintained, or vetted by Plesk. Install them at your own risk.
Installing PHP Extensions
When installing a PHP extension from PECL in Plesk, you associate it with a particular PHP handler. Any given extension may be installed and available for some PHP handlers, but not for others. Installing a PHP extension from PECL for a particular PHP handler makes it available for all PHP handler types using the same PHP version, but not for others.
For example, installing an extension for the 8.3.14 FPM application
handler also makes it available for the 8.3.14 FastCGI application
and 8.3.14 Dedicated FPM application
handlers, but not for the 8.2.25 FPM application
handler. If you want the extension to be available for the 8.2.25 FPM application
handler as well, you need to install it for that handler or any other handler using the same PHP version and binary.
Installing the Latest Version of an Extension
It is best practice to use the latest versions of software components. By default, the latest stable
available version of an extension is installed.
To install the latest version of an extension via the GUI:
-
Go to Tools & Settings, and then click PHP Settings (under „General Settings“).
-
Click the desired PHP handler, and then click Manage PECL Packages.
-
Locate the desired extension (use the search bar if necessary), and then click .
Once the extension is installed, it becomes available for that handler and any other handlers using the same PHP version and binary. You can find it in the list of other extensions available for those handlers. For example, here is the ioncube_loader
extension after being installed:
The installed extension is enabled by default, but can be disabled like any other PHP extension.
To install the latest version of an extension via the CLI:
-
Log in to the Plesk server via SSH as the
root
user. -
Führen Sie den folgenden Befehl aus:
plesk bin php_handler --extension-install <extension name> -id <handler id>
substituting <extension name> for the name of the extension, and <handler id>, for the ID of the desired PHP handler. For example, to install the
msgpack
extension for the PHP 8.3FPM application
handler, run the following command:plesk bin php_handler --extension-install msgpack -id plesk-php83-fpm
Bemerkung: To find out the ID of a PHP handler, run the
plesk bin php_handler --list
command.
Once the extension is installed, you can find it in the list of other extensions available for the PHP handler in question.
Installing a Specific Version of an Extension
Under some circumstances, you may need to use an earlier version of an extension, for example, for compatibility reasons. You can also use this procedure to install beta
versions of extensions.
To install a specific version of an extension via the GUI:
-
Go to Tools & Settings, and then click PHP Settings (under „General Settings“).
-
Click the desired PHP handler, and then click Manage PECL Packages.
-
Click Install package.
-
Specify the name of the desired package, plus the desired version or state, and then click OK.
For example, to install the latest
beta
version of themsgpack
extension, specify the following:msgpack-beta
To install the version 2.2.0 of the
msgpack
extension, specify the following:msgpack-2.2.0
Once the extension is installed, it becomes available for that handler and any other handlers using the same PHP version and binary. You can find it in the list of other extensions available for those handlers. For example, here is the ioncube_loader
extension after being installed:
To install a specific version of an extension via the CLI:
-
Log in to the Plesk server via SSH as the
root
user. -
Führen Sie den folgenden Befehl aus:
plesk bin php_handler --extension-install <extension name> -id <handler id>
substituting <extension name> for the name of the extension plus the desired version or state, and <handler id>, for the ID of the desired PHP handler. For example, to install the latest
beta
version of themsgpack
extension for the PHP 8.3FPM application
handler, run the following command:plesk bin php_handler --extension-install msgpack-beta -id plesk-php83-fpm
To install the version 2.2.0 of the
msgpack
extension for the PHP 8.3FPM application
handler, run the following command:plesk bin php_handler --extension-install msgpack-2.2.0 -id plesk-php83-fpm
Bemerkung: To find out the ID of a PHP handler, run the
plesk bin php_handler --list
command.
Once the extension is installed, you can find it in the list of other extensions available for the PHP handler in question.
Updating PHP Extensions
It is best practice to keep every software component on the server updated to the latest version. This includes PHP extensions.
When a newer version of an installed extension becomes available, the outdated extension is marked in the Plesk GUI with the icon, and can be updated to the latest version.
To update an installed extension to the latest version via the GUI:
-
Go to Tools & Settings, and then click PHP Settings (under „General Settings“).
-
Click the desired PHP handler, and then click Manage PECL Packages.
-
Locate the desired extension (use the search bar if necessary), and then click .
The extension will be updated to the latest version available in PECL.
It is also possible to update an installed extension via the CLI. To do so, use the same procedure as for installing the latest version of the extension. For example, to update the msgpack
extension installed for the PHP 8.3 FPM application
handler to the latest version, run the following command:
plesk bin php_handler --extension-install msgpack -id plesk-php83-fpm
The extension will be updated to the latest version available in PECL.
Removing PHP Extensions
Once you no longer need a software component, it is best practice to remove it to avoid potential conflicts and/or security issues. This includes PHP extensions. If you no longer need an installed extension, we recommend that you remove it. If the extension becomes necessary once again, you can reinstall it.
To remove an installed extension via the GUI:
-
Go to Tools & Settings, and then click PHP Settings (under „General Settings“).
-
Click the desired PHP handler, and then click Manage PECL Packages.
-
Locate the desired extension (use the search bar if necessary), click , and then confirm the removal.
Once the extension is removed, it becomes unavailable for that handler and any other handlers using the same PHP version and binary.
To remove an installed extension via the CLI:
-
Log in to the Plesk server via SSH as the
root
user. -
Führen Sie den folgenden Befehl aus:
plesk bin php_handler --extension-uninstall <extension name> -id <handler id>
substituting <extension name> for the name of the extension, and <handler id>, for the ID of the desired PHP handler. For example, to remove the
msgpack
extension from the PHP 8.3FPM application
handler, run the following command:plesk bin php_handler --extension-uninstall msgpack -id plesk-php83-fpm
Bemerkung: To find out the ID of a PHP handler, run the
plesk bin php_handler --list
command.
Once the extension is removed, it becomes unavailable for that handler and any other handlers using the same PHP version and binary.