About
An extension is a library that is not automatically present during the installation of php.
An extension is also known as module.
How to
Install them
In the PHP - php.ini and php configuration configuration, you need to:
- set the location of your extension file
- uncomment the extension that you want to load
Example
- Extension to load
[PHP]
; for image
extension=gd2
extension=mbstring
extension=pdo_sqlite
extension=openssl
- Path to the directory (generally not needed)
; some compilation needs the whole path for the extension dir
; extension_dir = "c:/php-7.2.28-Win32-VC15-x64/ext"
; some compilation (ie apache.dll) does not need the extension dir (ie 7)
; extension_dir = "ext"
Verify that an extension is loaded
at runtime
- Use the extension_loaded function. Example for DOM:
$loaded = extension_loaded("libxml");
- or the get-loaded-extensions function to get them all
with the cli (List the extension/module)
With the php cli, you can list the modules:
php -m
[PHP Modules]
bcmath
calendar
Core
ctype
date
dom
filter
gd
hash
iconv
json
libxml
mbstring
mysqlnd
openssl
pcre
PDO
pdo_sqlite
Phar
readline
Reflection
session
SimpleXML
SPL
standard
tokenizer
wddx
xdebug
xml
xmlreader
xmlwriter
zip
zlib
[Zend Modules]
Xdebug