All the installed PHP modules configuration files are available under /etc/php/{php_version}/mods-available directory. You can see the number of files with extension .ini. You must have installed specific PHP modules, you need to enable before using this tutorial. The php-common package provides followings commands to manage PHP modules. Show Advertisement
There are 3 types of SAPI (Server API) available – CLI, FPM, Apache2 being the most commonly used. You can define SAPI using Enable PHP ModulesUse phpenmod command followed by module name to enable specific PHP module on your system. In the below example, the first command is an example and the second command will enable mbstring module for all installed PHP versions and all SAPI. ### Syntax phpenmod MODULE_NAME ### Enable mbstring php module phpenmod mbstring You can also define the PHP version using ### Syntax phpenmod -v <PHP VERSION> <MODULE NAME> ### Enable module for specific php version phpenmod -v 5.6 mbstring phpenmod -v 7.4 mbstring Use ### Syntax phpenmod -s <SAPI> <MODULE NAME> ### Enable module for specific SAPI phpenmod -s cli mbstring phpenmod -s fpm mbstring phpenmod -s apache2 mbstring You can also define both the PHP version and SAPI for a more specific update. Disable PHP ModulesYou can also disable any un-necessary PHP modules from your system using phpdismod command. For example, disable mbstring module for ALL PHP versions and all SAPI. Plesk gives you the ability to enable or disable specific PHP extensions, and also to manually configure a wide range of PHP settings. These settings can be configured for every PHP version independently of all others (for example, you can set up a list of enabled extensions for PHP 5.3 that is entirely different to that of PHP 5.4) and are applied to every PHP handler type (for example, if you enable the xdebug extension for PHP 5.3, it will be enabled for all domains using PHP 5.3, whether they use CGI, FastCGI, or PHP-FPM handler). To change the PHP settings for an individual PHP version, go to Tools & Settings > PHP Settings and click the name of any of the PHP version + handler type combinations whose PHP version matches that whose settings you want to change. For example, if you want to change settings for PHP 5.3, you can click either 5.3.3 Apache module or 5.3.3 FastCGI application. You can manage the following PHP settings here:
Any changes you make will be in effect for all websites using that PHP version. Note that customers who have the permission to manage PHP settings are able to configure certain PHP settings for their domains and subdomains. Settings they configure on the domain level will override server-wide settings.
Native PHP versionExecute the command below to install an extension for the native PHP version: CentOS
BASH Debian
BASH Alternative PHP versionYou can install an extension for the alternative PHP version:
Install an extension using the package manager PeclLet's install memcache as an example:
Install from the source codeLet's install env as an example::
Note. The extension setup process may require additional packages that are not described in this article. × How do I enable PHP extensions in Windows?Step 1: Click on the Config button then select the php. ini file for your PHP installation, and open it in a text editor. Step 2: Locate the line that specifies the location of the “extension = ” line. Step 3: Look for the extension you want to install and remove the semicolon preceding that line.
How to add PHP extensions?Install an extension using the package manager Pecl. Install the packages: CentOS. ... . Install the extension: /opt/<PHP version directory>/bin/pecl install memcache. ... . Connect the extension for a required PHP version: echo extension=<extension library name> >> /opt/<PHP version directory>/etc/php.d/<extension name>.ini.. How do I show PHP extensions?If your server only has a single PHP version installed, you can run this PHP command anywhere, and it will give you the same list of modules. The general command we will be using is php -m. This command will give you the full list of installed PHP modules/extensions.
How to enable PHP extension Ubuntu?Follow these steps to install it:. Install the following package: sudo apt-get update sudo apt-get install -y autoconf.. Enable the module in the /opt/bitnami/php/etc/php.ini file by adding this line to the end: extension=redis.so.. Check that the module was correctly installed with the following command: php -m | grep redis.. |