"php -m" - Display Loaded Modules

This section provides a tutorial example on how to get a list of all loaded modules from the PHP runtime environment using the 'php -m' command or the get_loaded_extensions() function.

To get a list of all loaded modules, you can run the "php -m" command:

herong$ php -m 

[PHP Modules]
calendar
Core
ctype
date
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
openssl
pcntl
pcre
PDO
Phar
posix
readline
Reflection
session
shmop
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
Zend OPcache
zlib

[Zend Modules]
Zend OPcache

If you are running PHP scripts on a Web server, you can call the get_loaded_extensions() function in a script to get all loaded modules (extensions) in an array.

First write a simple script as shown below:

<?php 
# get-loaded-extensions.php
# Copyright 2009-2026 (c) HerongYang.com. All Rights Reserved.

  print("<pre>\n");
  $list = get_loaded_extensions();
  var_dump($list);
  print("</pre>\n");
?>

Upload the script to your Web server:

Then run the script using its URL (e.g. http://server.name/get-loaded-extensions.php) in a browser. You will see the same information as the "php -m" command.

Table of Contents

 About This Book

 Introduction and Installation of PHP

 Managing PHP Environment and Modules on macOS

 Managing PHP Environment and Modules on CentOS

Configuration and Modules

 Manage Runtime Configuration Directives

 "php -i" - Display Configuration Information

 php.ini - Configuration Directive File

 Additional .ini Configuration Files

 Load PHP Extensions/Modules

 extension_dir - Module Library Location

"php -m" - Display Loaded Modules

 get_extension_funcs() - Get Module Functions

 dl() - Load Module Dynamically

 cURL Module - Client for URL

 DOM Module - Parsing HTML Documents

 GD Module - Manipulating Images and Pictures

 MySQLi Module - Accessing MySQL Server

 OpenSSL Module - Cryptography and SSL/TLS Toolkit

 PCRE Module - Perl Compatible Regular Expressions

 SOAP Module - Creating and Calling Web Services

 SOAP Module - Server Functions and Examples

 Zip Module - Managing ZIP Archive Files

 References

 Index

 Full Version in PDF/EPUB