phpenmod – Used to enable modules in PHP phpdismod – Used to disable modules in PHP phpquery – Used to view status of modules of PHP

There are 3 types of SAPI (Server API) available – CLI, FPM, Apache2 being the most commonly used. You can define SAPI using -s switch to enable/disable module for that only.

Enable PHP Modules

Use 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. You can also define the PHP version using -v switch to enable specific modules. Using this you will enable the module for all SAPI. Use -s switch to define the SAPI to enable specific modules for specific SAPI for all PHP versions. You can also define both the PHP version and SAPI for a more specific update.

Disable PHP Modules

You 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. To disable any module for a specific PHP version use the command below. To disable any module for specific SAPI on all PHP versions, use the command below.