It's got to be somewhere in the phpinfo() dump, but I just don't know where. Is it supposed to be under the "Additional Modules" section? Somewhere else? I'm trying to figure out why some extensions don't appear to be loaded, but I don't even know where I should be looking.
11 Answers
Running
php -mwill give you all the modules, and
php -iwill give you a lot more detailed information on what the current configuration.

- 53,220
- 42
- 124
- 197
-
2This will you give you the modules loaded in PHP CLI context, which might be a different PHP than the one that is serving web requests – Lucas Bustamante Sep 29 '22 at 18:26
Run command. You will get installed extentions:
php -r "print_r(get_loaded_extensions());"
Or run this command to get all module install and uninstall with version
dpkg -l | grep php5

- 12,712
- 6
- 88
- 78
-
Or if you need it to look prettier (e.g. comma separated): `php -r "print_r(implode(', ', get_loaded_extensions()));"` – Jesse Nickles Dec 17 '20 at 22:07
use get_loaded_extensions()
PHP function

- 115,121
- 27
- 131
- 155
-
11This works on the command line `php -r 'print_r(get_loaded_extensions());'` it outputs the same list as `php -m` – phpguru Jul 14 '14 at 20:46
-
2cmd to export modules with version numbers: `php -r "phpinfo(INFO_MODULES);" | grep -B 3 -i version > modules.txt` – Agnius Vasiliauskas Nov 07 '18 at 08:05
You want to run:
php -m
on the command line,
or if you have access to the server configuration file open
/etc/php5/apache2/php.ini
and look at all the the extensions,
you can even enable or disable them by switching between On and Off like this
<Extension_name> = <[On | Off]>

- 2,315
- 4
- 27
- 39
<?php
echo "<pre>";
print_r(get_loaded_extensions());
echo "<pre/>";
?>

- 867
- 11
- 12
-
the list from php -m is much longer than get_loaded_extensions() which does not list curl, mbstring and many others? why is that? I installed curl, mbstring but they don't seem to show from the php script? – Meryan Mar 29 '20 at 08:56
-
How to sort get_loaded_extensions() alphabetically? to compare with other working php installs, thank you. – Meryan Mar 29 '20 at 17:57
-
1@Meryan I believe you're seeing a discrepancy between all extensions available (php -m) and the ones actually loaded. (get_loaded_extensions). In your case I believe that means you haven't enabled curl or mbstring. – beeThree May 03 '21 at 20:58
If you want to test if a particular extension is loaded you can also use the extension_loaded
function, see documentation here
php -r "var_dump(extension_loaded('json'));"

- 3,215
- 1
- 25
- 41
-
1I particularly like this solution and use it, because it allows my code to check for the required extension and die with a meaningful message. This means the code will tell me if something is wrong, I don't have to remember. I also add minimum PHP version checks - it's only a few lines of code. – Brian C Aug 27 '20 at 07:39
get_loaded_extensions()
output the extensions list.
phpinfo(INFO_MODULES);
output the extensions and their details.

- 2,829
- 1
- 19
- 24
I was having the same issue, I needed to know what modules were installed and their version. For now, my solution is to have PHP tell me from the command line. Note, "Core" is PHP.
php -r '$all = get_loaded_extensions(); foreach($all as $i) { $ext = new ReflectionExtension($i); $ver = $ext->getVersion(); echo "$i - $ver" . PHP_EOL;}'
Output:
Core - 7.4.30
date - 7.4.30
libxml - 7.4.30
...
mcrypt - 1.0.5
bcmath - 7.4.30
bz2 - 7.4.30
...
xml - 7.4.30
xmlwriter - 7.4.30
xsl - 7.4.30
zip - 1.15.6

- 314
- 3
- 11
Are you looking for a particular extension? In your phpinfo();
, just hit Ctrl+F in your web browser, type in the first 3-4 letters of the extension you're looking for, and it should show you whether or not its loaded.
Usually in phpinfo()
it doesn't show you all the loaded extensions in one location, it has got a separate section for each loaded extension where it shows all of its variables, file paths, etc, so if there is no section for your extension name it probably means it isn't loaded.
Alternatively you can open your php.ini file and use the Ctrl+F method to find your extension, and see if its been commented out (usually by a semicolon near the start of the line).

- 13,817
- 5
- 55
- 55

- 261,656
- 265
- 575
- 769
You asked where do you see loaded extensions in phpinfo() output.
Answer:
They are listed towards the bottom as separate sections/tables and ONLY if they are loaded. Here is an example of extension Curl loaded.
I installed it on Linux Debian with
sudo apt-get install php7.4-curl

- 1,285
- 12
- 25