Codex loosely only mentions PHP version in server requirements, however PHP can be configured in pretty wide range of excluding/including different parts.
What are extensions/libraries that:
- are required for WP to work at all? MySQL…
- are required for specific functions? GD ?…
- are preferred for best operation of specific functions? cURL…
- are commonly used by plugins? Zip…
I gave this some more thought and given size of WP code base (including bundled libraries) it doesn’t seem very realistic to compile such list by hand (and repeat it for every new version – meh).
I looked up appropriate static code analysis tool – PHP_CompatInfo and after some tinkering generated following report of extensions used by core (version scanned 3.3.1):
cURL – 127 uses (requires libcurl)
WP_Http_curl
)url_is_accessable_via_ssl()
SimplePie(overridden with classWP_SimplePie_File
)GoogleSpell(from TinyMCE package, is not used?)Date/Time – 367 uses
DOM – 6 uses (requires libxml)
iis7_rewrite_rule_exists()
iis7_delete_rewrite_rule()
iis7_add_rewrite_rule()
saveDomDocument()
POSIX Regex – 23 uses
Filter – 2 uses
PHPMailer->ValidateAddress()
(optional)FTP – 72 uses
ftp_base
ftp
(pure and sockets versions)WP_Filesystem_FTPext
WP_Filesystem_ftpsockets
GD – 56 uses
wp-adminincludesimage-edit.php
wp-adminincludesimage.php
wp-includesmedia.php
Hash – 6 uses
wp-includespluggable.php
multiple uses (optional – fallback inwp-includescompat.php
)iconv – 5 uses
SimplePie
(optional)wp_check_invalid_utf8()
(optional)wp-mail.php
(optional)JSON – 20 uses
wp-includes/compat.php
libxml – 4 uses
WP_oEmbed->_parse_xml()
(optional)Multibyte String – 29 uses
wp-includes/compat.php
MySQL – 60 uses
wpdb
class(overridden with classSimplePie_Cache
WP_Feed_Cache
)OpenSSL – 4 uses
PHPMailer
PCRE – 743 uses
SimpleXML – 1 uses
WP_oEmbed
(seems optional)Sockets – 64 uses
ftp
(sockets
implementation)SPL – 3 uses
Tokenizer – 3 uses
wp_doc_link_parse()
(optional)XML Parser – 89 uses
XMLReader – 1 uses
Zlib – 30 uses
The answer for this might be complicated and very long, as far as I know, there will also be some differences between servers & OS (IIS, Apache).. I can not say that the following list is a FULL list, but it includes some of those I know that are required :
Curl and CurlSSL â Not sure it is REQUIRED but but much of the WordPress code will use it if it is available.
Many plugins however DO require it and/or will have limited functions without it.
Exif â allows media handler of WordPress to pull Exif data
out of images.
Gettext – .po .mo handling translation localization internationalization ..
FTP â used to do plugin and WordPress upgrades via FTP.
GD â No need introduction, right ?.
Iconv â character set conversions for everything from mail to RSS parsing.
Mbregex and Mbstring â the name is pretty descriptive – provide functions used all over the place 🙂
Mcrypt â Not needed for wordpress, but many plugins do need it.
Mime Magic â Deprecated now in wordpress – but still good to have for back compatibility.
*Mysql and Mysql of the system *â we all know what this is and why it is needed, no ?
Openssl â This library is used to handle processing connections
encrypted with SSL certificates for WordPress may to be able to connect to any SSL (https) encrypted location.
POSIX â used to ensure that WordPress properly maintains file permissions and ownerships .
Path Info Check â some permalink setups .
Pspell â spell checking capabilities to TinyMCE, .
Sockets â managing FTP connections and mail handling AKA SMTP and POP in WordPress.
Zip â Not sure if REQUIRED – but this cross-platform compatible zip file creation and extraction class WILL be used by wordpress if available.
Zlib â Used in many cases . example – js and css files compression. again, not sure if REQUIRED but needed.
Like Above stated – this is by no means a FULL list – It was compiled about a year ago – and it might need some update . Many of those functions are not exactly REQUIRED but ADVISED. In many cases wordpress will use a function IF it is available, and if not , will ignore the task.
A good example is the lack of GD library, it will not stop wordpress from functioning, but it will not crop, resize , or alter the uploaded images – thus leaving the original (and grey- out the “size” option in the “insert image to post” function)..
As a side note – I would also say that maybe this question will probably get more correct/updated answers on serverfault.com than here …
(This is not intended to be an answer. Just some useful information. If you think this info is not useful, let me know, I’ll simply delete it.)
I think talking in terms of packages would be easier for newbies, but since packages vary from system to system, it’s hard to cover all of them.
As I have experience with Debian (& Debian-based distros), I’d like to share this specific information:
The aforementioned packages install all the extensions/libraries/modules mentioned in the other answers; all, except Mime Magic, which is no longer required by WordPress.
Another good way to make sure your server is 100% compatible with WordPress is to check what packages the managed hosting companies come pre-installed with. As they have years of experience with customer complaints about incompatibilities, they’ll know better.
In case of Hostgator, the PHP modules they pre-install include (you’ll probably only need most but not all of them):
Media Temple provides a
phpinfo();
file for you to check their config. It’s useful for comparison purposes too.If you want an easy way to verify if your server meets these requirements, there’s now a handy WP-CLI ext command to do so.
wp ext required
shows all PHP extensions necessary to run WordPress, whilewp ext recommended
shows optional ones.wp ext check
is a combination of both commands.These come in handy when you need a quick way to check the system requirements on a new server and/or if you want to further process this list programmatically.
Here’s how
wp ext required
works:I’ve developed my WordPress environment checker. It is a simple class, runs on web SAPI or on CLI.
This is the maintained version https://github.com/szepeviktor/debian-server-tools/blob/master/webserver/php-env-check.php
Based on the work of @rarst
The WordPress handbook now lists the recommended PHP modules:
It also lists the following PHP extensions as being optional:
If you’re using Debian 7 (Debian Wheezy), you need to install PHP itself and a small number of extensions. Most of what was mentioned by @Rarst is already included with one of Debian’s most basic PHP installs.
PHP
You have four options in Debian Wheezy: libapache2-mod-php5, libapache2-mod-php5filter, php5-cgi, or php5-fpm. I choose php5-fpm but it all depends on how you want your web server and PHP to interact.
MySQL
You also need PHP to use MySQL. Your options are php5-mysql and php5-mysqlnd. php5-mysqlnd is native and generally faster. Some might choose an alternative like MariaDB.
Graphics Library Optional
If you want your images resized, you may install either php5-gd or php5-imagick. php5-imagick will give you better quality and WordPress will use it if it’s available. If both are installed, php5-imagick will be used. If neither is installed, images will not be resized (and WordPress won’t complain).
HTTP Optional
If you install php5-curl, it will be used but is not required for anything except perhaps better performance.
Nothing else is required by WordPress and most extensions, though some extensions may have other requirements.
Here is the complete basic install line to give WordPress everything it needs for optimal performance and nothing it doesn’t:
It’s worth mentioning that since WordPress 5.2, there is a built in feature that reports on missing modules. Find it at Tools > Site Health.
A small “cheatsheet” when installing PHP for WordPress on Debian:
0. Add the dotdeb repository
Add these two lines to your
/etc/apt/sources.list
file:Add the GPG key:
Update the “package list”:
1. Install PHP 7:
Source: http://php.net/manual/en/install.unix.debian.php
2. List of modules, which are included in the “php7.0-common” package:
Source: https://packages.debian.org/sid/amd64/php7.0-common/filelist
3. To install the additional modules which are required/recommended by wordpress:
Source: https://wordpress.stackexchange.com/a/42141/107878
4. I couldn’t find the following on debian:
5. “apt-cache search php7” returns:
Reference: https://packages.debian.org/source/sid/php7.0
you need the mysqli, pdo, and gd extensions. and sometimes xml-rpc.
I’ve been running WP with the mysqlnd native extension for a while now, it’s pretty neat. Has reflection stuff built in, so if you want to see what’s going on with the db in that specific request, you can do it.
zip as an extension is not needed, most programs call the system zip executable.
Officially, WordPress.org says that only the following PHP extensions are required as of WP Core 5.3+ and when using the recommended version of PHP, which is currently PHP 7.2:
…but they also recommend the following optional extensions:
Keep in mind, however, that some of these required (or optional) extensions are already bundled into other PHP packages. For example,
dom
is often included in thexml
extension. And others likefileinfo
are probably already installed as part of a so-calledphp-common
package if you are using Ubuntu, etc.In addition, there are a few other extensions such as
bcmath
that are not officially required or recommended by WordPress but are still used by many popular plugins, like Yoast SEO.You can follow our list of WordPress PHP extensions over at LittleBizzy if interested.