Similarly, to extending WordPress core functionality by installing plugins, the core PHP programming language can gain additional functionality by using extensions. WordPress core makes use of various PHP extensions when they’re available. If the preferred extension is missing WordPress will either have to do more work to do the task the module helps with or, in the worst case, will remove functionality.
PHP extensions are compiled libraries installed in a folder within the PHP installation folder. The extract folder name is specified in the php.ini configuration file – there is no default extension folder file or pathname. To find the folder on Linux-based installations, from the command line you can type:
php -i | grep extension_dir while on other operating systems, you can look directly in the php.ini configuration file to locate the extensions directory. Or use PHP selector under cPanel.
PHP extensions for core functionality
The PHP extensions listed below are required for a WordPress site to work.
- json: Used for communications with other servers and processing data in JSON format.
- One of either mysqli, or mysqlnd: Connects to MySQL for database interactions.
PHP extensions for optimal functionality and compatibility
The PHP extensions listed below are highly recommended in order to allow WordPress to operate optimally and to maximize compatibility with many popular plugins and themes.
- curl: Performs remote request operations.
- dom: (requires libxml): Used to validate Text Widget content and to automatically configure IIS7+.
- exif: Works with metadata stored in images.
- fileinfo: Used to detect mimetype of file uploads.
- hash: Used for hashing, including passwords and update packages.
- imagick: Provides better image quality for media uploads.
- mbstring: Used to properly handle UTF8 text.
- openssl: Permits SSL-based connections to other hosts.
- pcre: Increases performance of pattern matching in code searches.
- xml: Used for XML parsing, such as from a third-party site.
- zip: Used for decompressing Plugins, Themes, and WordPress update packages.
PHP extensions for WordPress cache
The PHP extensions listed below are recommended to allow some WordPress cache (if necessary).
- memcached: memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.
- opcache: PHP can be configured to preload scripts into the opcache when the engine starts.
- redis: PHP extension for interfacing with Redis.
PHP extensions for fallback functions
The PHP extensions listed below are fallbacks or optional and not necessarily needed in an optimal environment. WordPress may use them in certain situations or if other modules are unavailable.
- bcmath: For arbitrary precision mathematics, which supports numbers of any size and precision up to 2147483647 decimal digits.
- filter: Used for securely filtering user input.
- image: If Imagick isn’t installed, the GD Graphics Library is used as a functionally limited fallback for image manipulation.
- iconv: Used to convert between character sets.
- intl: Enable to perform locale-aware operations including but not limited to formatting, transliteration, encoding conversion, calendar operations, conformant collation, locating text boundaries and working with locale identifiers, time zones and graphemes.
- simplexml: Used for XML parsing.
- sodium: Validates Signatures and provides securely random bytes.
- xmlreader: Used for XML parsing.
- zlib: Gzip compression and decompression.
PHP extensions if files are non-writable on the server
These extensions are used for file changes, such as updates and plugin/theme installation, when files aren’t writeable on the server.
- ssh2: Provide access to resources (shell, remote exec, tunneling, file transfer) on a remote machine using a secure cryptographic transport.
- ftp: Implement client access to files servers speaking the File Transfer Protocol (FTP).
- sockets: Implements a low-level interface to the socket communication functions based on the popular BSD sockets.