list all modules in php

How to List Installed PHP Modules in Linux

PHP is a popular programming language that allows you to quickly develop websites and web applications. It supports a vast range of modules and plugins that you can include in your PHP installation to increase the functionality of your websites. As you add more and more modules to our PHP installation, we may end up losing track of which modules are available and which ones aren’t. In such cases, to simply list installed PHP modules in Linux. In this article, we will learn how to list installed PHP modules in Linux.

How to List Installed PHP Modules in Linux

Here are the steps to list PHP modules. Some packages are compiled with PHP installation, while others are installed after PHP is installed. We will learn how to get list of both types of modules.

How to List Compiled PHP modules

If you want to view list of all compiled PHP modules, open terminal and run the following command.

# php -m

The above command will show all compiled packages, which can be quite long. If you are looking for a specific compiled package, just pass the above command’s output to grep command. Here is the command to search if ftp module is compiled or not.

# php -m | grep -i ftp

In the above command, we use -i option with grep to ignore case of module names.

How to List Installed PHP modules

You can also install modules via Linux package managers such as yum, dnf, dpkg.

# yum list installed		#RHEL/CentOS
# dnf list installed		#Fedora 22+
# dpkg --get-selections		#Debian/Ubuntu

The above commands will list all modules that you have installed via package managers. If you are looking for a specific module, you can pass the output of above command to grep command and search for the required package. Here is the command to search for ftp module in PHP.

# yum list installed | grep -i ftp		#RHEL/CentOS
# dnf list installed | grep -i ftp		#Fedora 22+
# dpkg --get-selections | grep -i ftp		#Debian/Ubuntu

3. Using PHPInfo

Alternatively, you can create a small PHP file and add it to the root of your website, in order to view the list of all modules in your web browser. It is called phpinfo() file. Create an empty test.php file at the root location of your website where all your other documents about your website are stored. You can use any filename you want as long as the extension is .php.

Add the following lines to it.


Avoid using index.php as filename since it generally stands for the home page, and also avoid using phpinfo.php since it will make it easy for hackers to find out about your PHP installation.

Now you can directly view it in browser by going to the URL http://your_domain_or_ip/test.php. Replace your_domain_or_ip with your domain name or server IP address. This web page will give you complete information about your PHP installation such as version of PHP in use, the core functions available, and the modules being loaded.

There are several ways to add modules to PHP installation. In this article, we have learnt how to list installed PHP modules, whether they are compiled during PHP installation or installed via package manager.

Also read:

Fix “Too Many Authentication Failures” SSH Error
How to List All Virtual Hosts in Apache
How to Create Virtual Hard Disk Volume from File
How to Downgrade Software in Ubuntu
How to Downgrade RHEL/CentOS to Previous Minor Release

Leave a Reply

Your email address will not be published. Required fields are marked *