What Are PHP Extensions?
What a PHP Extension Adds to the Language
PHP extensions are add-on modules that give PHP functions and capabilities beyond its core language. Extensions are often called modules, and the two terms mean the same thing. Once an extension is loaded when PHP starts, its functions are available to every script, just like built-in ones.
The core of PHP stays small on purpose. Tasks such as connecting to certain databases, handling image formats or working with multibyte text are delegated to extensions. This lets a PHP build be tailored to what a site needs.
Extensions are switched on or off in the php.ini file or in separate configuration files that PHP reads at startup. Two sites on the same server can therefore load different sets. Which extensions are available also depends on the PHP version and how the build was made.
Common Extensions Applications Depend On
Many popular applications list required extensions in their documentation. A site that lacks one will often show a blank page or an error when that feature runs.
- mbstring handles multibyte text, such as UTF-8 characters, so string functions count and split characters correctly.
- intl provides internationalization features such as locale-aware formatting and sorting.
- cURL lets PHP make outbound HTTP requests, for example to call a payment provider's API.
- GD and Imagick create and change images, such as generating thumbnails. Imagick wraps the ImageMagick library.
- sodium and OpenSSL provide encryption and secure connection functions.
The lists differ between applications, so the requirements of the software you run are the reliable reference.
Frequently asked questions
How can I see which extensions are installed?
Run php -m in a command line session to list the modules loaded for the command line version of PHP. The web server may use a different configuration, so a page that calls phpinfo(), or the host's control panel, shows what the website actually loads.
What happens if a required extension is missing?
The application usually fails when it first calls a function from that extension. The error often names the missing function or class, and some software refuses to install until the dependency is present. The fix is to enable the extension through the host or the configuration, not to change the application code. Packages managed with Composer often list their extension needs in their metadata.