List of Compiled and Installed PHP Modules in Linux

If you’ve installed a lot of PHP extensions or modules on your Linux system and want to know if a specific PHP module is installed or not, or if you just want a complete list of PHP extensions installed on your Linux system.

We’ll show you how to list all installed or built PHP modules from the Linux command line in this article.

How to List Compiled PHP Modules

php -m is a general command that displays a list of all “compiled” PHP modules.

#php -m

Complete PHP Modules

apc
bz2
calendar
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
json
libxml
mbstring
mcrypt
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
sqlite3
standard
tidy
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
zip
zlib

Using the grep command, you can look for a specific PHP module, such as php-ftp. Simply run the above program with the result piped to grep as displayed (grep -i flag means ignore case distinctions, thus typing FTP instead of FTP should work).

# php -m | grep -i ftp

ftp

How to List Installed PHP Modules

Use the relevant command for your distribution to list any PHP modules you’ve installed using a package manager.

# yum list installed | grep -i php #RHEL/CentOS
# dnf list installed | grep -i php #Fedora 22+
# dpkg --get-selections | grep -i php #Debian/Ubuntu

Listing Installed PHP Modules

php.x86_64 5.3.3-49.el6 @base
php-cli.x86_64 5.3.3-49.el6 @base
php-common.x86_64 5.3.3-49.el6 @base
php-devel.x86_64 5.3.3-49.el6 @base
php-gd.x86_64 5.3.3-49.el6 @base
php-mbstring.x86_64 5.3.3-49.el6 @base
php-mcrypt.x86_64 5.3.3-5.el6 @epel
php-mysql.x86_64 5.3.3-49.el6 @base
php-pdo.x86_64 5.3.3-49.el6 @base
php-pear.noarch 1:1.9.4-5.el6 @base
php-pecl-memcache.x86_64 3.0.5-4.el6 @base
php-php-gettext.noarch 1.0.12-1.el6 @epel
php-tidy.x86_64 5.3.3-49.el6 @base
php-xml.x86_64 5.3.3-49.el6 @base

If you wish to search for a specific module, use a pipe and the grep command, as illustrated.

# yum list installed | grep -i php-mbstring #RHEL/CentOS # dnf list installed | grep -i php-mbstring #Fedora 22+ # dpkg --get-selections | grep -i php-mbstring #Debian/Ubuntu

Run to see all of the PHP command-line options.

# php -h