List compiled modules with the PHP CLIList compiled modules with the PHP CLI

Posted June 29th, 2008 in PHP

The PHP CLI (Command Line Interface) has a number of flags which can be passed to it for executing PHP scripts, getting information about your PHP install and so on. This post looks at how to get a list of the modules compiled into the PHP CLI. Note that depending on the way your distribution/package has compiled PHP, the list of modules available for the webserver and the CLI may be different.

Passing the -m flag to the PHP CLI will show a list of the compiled in modules:

php -m

Example output from PHP 5.1.6 on CentOS 5.0 is as follows (from a default install with a couple of additional modules installed):

[PHP Modules]
bz2
calendar
ctype
curl
date
dom
exif
ftp
gd
gettext
gmp
hash
iconv
libxml
mime_magic
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
posix
pspell
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
zlib

[Zend Modules]

This can be useful for checking to see if a particular module is available.

Recent posts: