LinuxCommandLibrary

phpdismod

TLDR

Disable extension for all PHP versions and SAPIs

$ sudo phpdismod [extension]
copy
Disable extension for specific version and SAPI
$ sudo phpdismod -v [7.4] -s [cli] [extension]
copy

SYNOPSIS

phpdismod [-v version] [-s sapi] module

DESCRIPTION

phpdismod disables PHP extensions on Debian-based systems by removing the symbolic link from the conf.d directory. Without version or SAPI specified, it disables the extension for all installed PHP versions and all SAPIs.
The command works by manipulating symlinks in /etc/php/VERSION/SAPI/conf.d/ that point to module configuration files in mods-available.

PARAMETERS

-v _version_

PHP version (e.g., 7.4, 8.0, 8.1)
-s _sapi_
SAPI type (cli, fpm, apache2, cgi)
module
Extension name to disable

CAVEATS

Debian/Ubuntu specific tool. Requires root privileges. Changes take effect after restarting PHP-FPM or Apache. Some extensions have dependencies that may cause issues when disabled.

HISTORY

phpdismod is part of the php-defaults package maintained by the Debian PHP team. It provides a standardized way to manage PHP extensions, similar to how a2enmod/a2dismod manage Apache modules.

SEE ALSO

phpenmod(8), phpquery(8), php(1)

Copied to clipboard