php -m List compiled modules with the PHP CLI

$ php -m
[PHP Modules]
xml
tokenizer
standard
sockets
session
posix
pcre
overload
mysql
mbstring
ctype

[Zend Modules]

php 代码检测模块加载,并编程方式手动加载模块:
bool extension_loaded(string $name);

if (!extension_loaded('gd')) {
    if (!dl('gd.so')) {
        exit;
    }
}

PS: list apache modules: httpd -M http://php.net/manual/en/function.apache-get-modules.php