Skip to main content

How to check, disable and enable PHP modules.

check disable and enable

How to check, disable and enable PHP modules.

Description:

In this tutorial, we will learn how to check, disable and enable PHP modules.If you run a system or web server, you need to know how to install and use different versions of PHP on the same server. This is very helpful when you have more than one PHP programme on your server and each one works with a different version of PHP. Linux distribution Ubuntu supports PHP. PHP needs to be introduced, as opposed to Python, which is preinstalled in the basic system.

a2enmod is a script that enables the specified module within the apache2 configuration. It does this by creating symlinks within /etc/apache2/mods-enabled. Likewise, a2dismod disables a module by removing those symlinks. It is not an error to enable a module which is already enabled, or to disable one which is already disabled.

How to show enabled php modules

You can show every mod which is being used by php.

# a2query -m 

Every PHP mod used by php

Every PHP mod used by php

How to disable a php module

Step 1. First we should check, which modules are enabled.

# a2query -m 

All enabled mod

All enabled mod

Step 2. Now if you want to disable any module, just remember the first word of the above output. For example, if you want to disable php7.3 module

# a2dismod php7.3 

All disabled mod

All disabled mod

How to enable any module

Now to add any module, you just need to know the name of the mod

# a2enmod php7.4 

Add the php7.4 mod

Add the php7.4 mod

Now after enabling any php mod, you need to reload the daemon service and restart the apache.

Now finally check whether the desired module is enable or not

# a2query -m 

Check the enabled mod

Check the enabled mod

In this article you have learnt how to check, disable and enable PHP modules.