How to list all the loaded extensions by PHP

In this tutorial, we will see how to install and check the PHP extensions loaded on Linux using a command terminal or GUI web interface.

PHP is a popular computer language used by thousands of web servers to run various web applications. It is an open-source distributed under the PHP license. The abbreviation PHP originally stands for Personal Home Page Tools also popularly known as Hypertext Preprocessor. The PHP infrastructure is installed on an estimated 82% of all web servers on the Internet. More than 200 million apps and websites developed with PHP are online. Over 5 million software developers use the programming language.

It is a scripting language that runs on the server-side to be used to convert PHP coded text files into machine code by the web server when they are called up. It is platform-independent and can be used on any hardware.

The first PHP interpreter was developed in 1995 by Rasmus Lerdorf, who is considered to be the inventor of PHP.  Today PHP has modern semantics and is available in ready-made installation packages for many operating systems. An extensive object-oriented programming language has grown out of this, which is now available in version 8. Extensive information is available for PHP with the help of its broad community of programmers.

PHP is not only to be regarded as a syntactic-formal programming language but also as a technical-strategic platform. Because when we talk about PHP today, we mean not only the PHP-typical syntax but also ready-made PHP installation packages (stacks) that are available for many systems; simple, partly symbiotic database connection and administration; widespread use by commercial web hosts, global infrastructure; diverse programming libraries available; possibility to use well-tested open source solutions; linking with professional IDE and development tools.

How to install Install PHP and its extensions

On Linux, it is very easy to install PHP and the required extensions needed by various web applications to work properly. Almost all the Linux Desktop and server operating systems come with a package manager to install PHP directly from the base repository.

For example:

On Ubuntu or Debian based Linux:

To install PHP just run:

sudo apt install php

On Redhat Linux

For RHEL and its based systems such as Oracle Linux, CentOS, Rocky, and Alamalinux, the command to install PHP will be:

sudo yum install php

whereas for extensions, the same command but with extension name. Let’s say you want to install a PHP extension required by it to work properly with the installed MySQL server i.e mysqli. To install it:

sudo apt install php-extension-name

sudo apt install php-mysqli

Whereas, if you want to install multiple extensions simultaneously, we can use the following syntax:

sudo apt install php-{exention1,exetension2,extenion3}


sudo apt install php-{curl,dom, gd,json,mbstring,msqli,tokenizer,zip}


List all the installed and loaded PHP extensions

Once you installed all the required extensions on your Linux system and now you want to see what are those? For that, we can use two methods- command line or web GUI. We will show you both.

Check Loaded PHP exertions or modules using command line

On your system where you have installed the PHP, access the terminal and type:

php -r "print_r(get_loaded_extensions());"

List all the installed and loaded php extensions


You can also use:

But in this command the extensions will be listed in just one row, rather than in list form:

php -r "print_r(implode(', ', get_loaded_extensions()));"

List PHP extensions on Linux

Apart from them, here are other commands to get the list of loaded PHP modules:

php -m


Check PHP extension loaded using web GUI

To get the pretty look and interactive way to get the information about all the loaded PHP modules, we can create a file inside our web root directory and get the list using a web server such as Apache.

sudo nano /var/www/html/info.php

Add the following lines:




Save the file- Ctrl + O, hit the Enter key, and then press Ctrl+X.

Now, open any browser that can access the webserver Ip-address or domain name. And in the URL box, type something like the below:


You will have the installed PHP’s complete information on your browser interface.

php check module list using GUI web


Other Articles:

Easy way to Install PHP 8.0 on Debian 11 Bullseye Server
Steps to install PHP 8 on Debian Server 10 | 9
How to install Gnome 41 in Ubuntu 20.04 LTS using PPA
How to install Apache, MySQL, and PHP on AlmaLinux 8




Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.