PHP Modules Tutorials - Herong's Tutorial Examples - v5.19, by Herong Yang
Load PHP Extensions/Modules
This section describes how PHP modules are distributed and loaded into the PHP runtime environment.
What Is PHP Module? - A PHP Module is a software component developed to add extra functionalities to the PHP core component.
PHP Modules are also referred as PHP Extensions, because they are extending the PHP core component.
Here are some commonly used PHP extensions:
PHP Modules can be loaded (and enabled) into the PHP runtime environment in different ways:
1. Built-in with the PHP core - Some modules are considered as core modules. They are developed and enabled together with PHP core. No separate library files are needed for core modules. For example, "hash" is a core module.
2. Bundled with the PHP core binary code - Some modules are compiled and enabled by the build tool (e.g. ./configure). No separate library files are generated for bundled modules. For example, "mbstring" is a bundled module in the distribution binary code on my macOS computer.
3. Included in the distribution package - Some modules are included in the distribution package as separate library (.so or .dll) files located in the extension directory. You need to check php.ini or additional .ini file to see if it is enabled. For example, "json" is an include module in the distribution package on my Ubuntu computer.
4. Distributed separately - Some modules are not included in the distribution package, but available in package repositories. You need to run the installation command to download and install them from package repositories. For example, "soap" is not included on my Ubuntu computer. So I need to run "sudo apt install php-soap" install it. The installation process will enable it through an additional .ini file: /etc/php/7.2/mods-available/soap.ini.
5. Available as source code - Some modules are available only as source code. You need to download them and follow their instructions to build and enable them.
See other chapters in this book for more information on how to install and enable modules on specific computer systems.
Table of Contents
Introduction and Installation of PHP
Managing PHP Environment and Modules on macOS
Managing PHP Environment and Modules on CentOS
Manage Runtime Configuration Directives
"php -i" - Display Configuration Information
php.ini - Configuration Directive File
Additional .ini Configuration Files
extension_dir - Module Library Location
"php -m" - Display Loaded Modules
get_extension_funcs() - Get Module Functions
dl() - Load Module Dynamically
DOM Module - Parsing HTML Documents
GD Module - Manipulating Images and Pictures
MySQLi Module - Accessing MySQL Server
OpenSSL Module - Cryptography and SSL/TLS Toolkit
PCRE Module - Perl Compatible Regular Expressions
SOAP Module - Creating and Calling Web Services
SOAP Module - Server Functions and Examples