How to list all extensions loaded by PHP


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

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

It is a server-side scripting language to convert PHP encoded text files to machine code by the web server when called. 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-to-use installation packages for many operating systems. A large object-oriented programming language grew out of this, which is now available in version 8. A lot of information is available for PHP with the help of its large community of programmers.

PHP should not only be seen as a syntactic-formal programming language, but also as a technical-strategic platform. Because when we talk about PHP today, we mean not only typical PHP syntax, but also out-of-the-box PHP installation packages (stacks) available for many systems; simple and partially symbiotic database connection and administration; widespread use by commercial hosts, global infrastructure; various programming libraries available; possibility of using well tested open source solutions; link with professional IDE and development tools.

How to install Install PHP and its extensions

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

For example:

On Linux based on Ubuntu or Debian:

To install PHP just run:

sudo apt install php

On Redhat Linux

For RHEL and its systems based on Oracle Linux, CentOS, Rocky and Alamalinux, the command to install phpo will be:

sudo yum install php

while for extensions, the same command but with job name. Let’s say you want to install some php extension required to work properly with MySQL server installed 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 php extensions installed and loaded

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

Check efforts or PHP modules loaded using command line

On your system where you installed PHP, go to terminal and type:

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

You can also use:

But in this command, the extensions will be listed on a single line, rather as a list:

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

List PHP extensions on Linux

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

php -m

Check the loaded PHP extension using the web GUI

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

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

Add the following lines:

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

Now open any browser that can access the web server IP address or domain name. And in the URL box, type something like below:


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

list of php checking modules using web GUI

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


Comments are closed.