How to List Compiled and Installed PHP Modules in Linux

If you have installed a number of PHP extensions or modules on your Linux system and you trying to find out a particular PHP module has been installed or not, or you simply want to get a complete list of installed PHP extensions on your Linux system.

In this article, we will show you how to list all installed or compiled PHP modules from Linux command line.

How to List Compiled PHP Modules

The general command is php -m, which will show you a list of all “compiled” PHP modules.

# php -m
Listing Compiled 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

You can search for a specific PHP module for instance php-ftp, using the grep command. Simply pipe the output from the above command to grep as shown (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

To list all PHP modules that you have installed via a package manager, use the appropriate command below, for your distribution.

# 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    

In case you want to find one particular module, like before, use a pipe and the grep command as shown.

# 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

To view all php command line options, run.

# php -h

You might also like to check out these following useful articles about PHP.

  1. 12 Useful PHP Commandline Tricks Every Linux User Should Know
  2. How to Use and Execute PHP Codes in Linux Command Line
  3. How to Install Different PHP Versions in Ubuntu
  4. How to Install OPCache to Speed Up Performance of PHP Apps

That’s all! In this article, we’ve explained how to list installed (or compiled in) modules in PHP. Use the comment form below to ask any questions.

If this article helped, with someone on your team.

TecMint Weekly Newsletter
Get the Learn Linux 7 Days Crash Course free when you join 34,000+ Linux professionals reading every Thursday.
Check your email for a magic link to get started.
Something went wrong. Please try again.
TecMint has been free for 14 years. Help keep it that way.
Google AI Overviews and tools like ChatGPT have cut into search traffic for independent tech sites like TecMint. Running this site costs over $2,000 every month for hosting, infrastructure, and paying authors to keep the content accurate and tested.

If this article helped you solve a problem, consider buying a coffee. It helps keep TecMint free, supports the authors, and keeps the project going.
☕ Buy Me a Coffee
Aaron Kili
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

4 Comments

Leave a Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.

Free Course
Get a free Linux course before you go.
Subscribe to TecMint Weekly and get the Learn Linux 7 Days Crash Course free. Read by 34,000+ Linux professionals every Thursday.
Something went wrong. Please try again.
Check your email for a magic link to get started.