≡ Menu

How to list all loaded extensions on PHP?

The question is – I need a way to find a way to get all loaded PHP modules and extensions in my PHP script. Is there a PHP command or argument that can be used to do this?

PHP has a method called get_loaded_extensions() which returns an array of all loaded extensions. This very simple command can be used without any arguments to get all loaded and installed modules in your local PHP installation!

Create a PHP file called extensions.php. Add the following to it:

<?php
print_r(get_loaded_extensions());
?>

Then, upload the file to your web server and visit http://www.yourdomain.com/extensions.php or use the following command on your SSH shell session or a local terminal:

php extensions.php

This will output something like the following:

Array
(
[0] => date
[1] => libxml
[2] => openssl
[3] => pcre
[4] => zlib
[5] => bcmath
[6] => calendar
[7] => ctype
[8] => curl
[9] => dom
[10] => filter
[11] => ftp
[12] => gd
[13] => gettext
[14] => hash
[15] => iconv
[16] => session
[17] => json
[18] => mbstring
[19] => mcrypt
[20] => mysql
[21] => SimpleXML
[22] => posix
[23] => Reflection
[24] => standard
[25] => SPL
[26] => mysqli
[27] => sockets
[28] => SQLite
[29] => imap
[30] => tokenizer
[31] => xml
[32] => xmlreader
[33] => xmlwriter
[34] => zip
[35] => timezonedb
)

Thats the list of all PHP extensions that are installed and loaded by your PHP interpreter!

Comments on this entry are closed.