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
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 FTPinstead of ftp should work).
# php -m | grep -i ftp ftp
How to List Installed PHP Modules
# yum list installed | grep -i php #RHEL/CentOS # dnf list installed | grep -i php #Fedora 22+ # dpkg --get-selections | grep -i php #Debian/Ubuntu
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
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.