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:

  1. are required for WP to work at all? MySQL...
  2. are required for specific functions? GD ?...
  3. are preferred for best operation of specific functions? cURL...
  4. are commonly used by plugins? Zip...
  • Do you aware that there is a SSL error on your site(queryposts.com) ? – I am the Most Stupid Person Jul 19 at 9:31
  • @IamtheMostStupidPerson thank you, automated certificate renewal had failed there for some reason, should be fixed now. – Rarst Jul 19 at 11:37
  • No worries, It is Let's Encrypt. isn't? I thought it automatically renew... In case if it isn't automatically renew as your case, what can we do? – I am the Most Stupid Person Jul 19 at 13:06
  • @IamtheMostStupidPerson hosting support had reset it (it was set up through their integration), it does normally renew automatically for me. – Rarst Jul 19 at 13:25
  • Extremely hard to find, but there is an official recommendation: make.wordpress.org/hosting/handbook/handbook/server-environment/… – aidanh010 Nov 6 at 7:04
up vote 81 down vote accepted
+50

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)

    • HTTP API (class WP_Http_curl)
    • url_is_accessable_via_ssl()
    • SimplePie (overridden with class WP_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

    • class PHPMailer->ValidateAddress() (optional)
  • FTP - 72 uses

    • class ftp_base
    • class ftp (pure and sockets versions)
    • class WP_Filesystem_FTPext
    • class WP_Filesystem_ftpsockets
  • GD - 56 uses

    • wp-admin\includes\image-edit.php
    • wp-admin\includes\image.php
    • wp-includes\media.php
  • Hash - 6 uses

    • wp-includes\pluggable.php multiple uses (optional - fallback in wp-includes\compat.php)
  • iconv - 5 uses

    • class SimplePie (optional)
    • wp_check_invalid_utf8() (optional)
    • wp-mail.php (optional)
  • JSON - 20 uses

    • optional, fallbacks in wp-includes/compat.php
  • libxml - 4 uses

    • class WP_oEmbed->_parse_xml() (optional)
    • SimplePie
  • Multibyte String - 29 uses

    • some fallback in wp-includes/compat.php
  • MySQL - 60 uses

    • class wpdb
    • class SimplePie_Cache (overridden with class WP_Feed_Cache)
  • OpenSSL - 4 uses

    • class PHPMailer
  • PCRE - 743 uses

  • SimpleXML - 1 uses

    • class WP_oEmbed (seems optional)
  • Sockets - 64 uses

    • class ftp (sockets implementation)
  • SPL - 3 uses

  • Tokenizer - 3 uses

    • wp_doc_link_parse() (optional)
  • XML Parser - 89 uses

  • XMLReader - 1 uses

    • SimplePie (seems optional)
  • Zlib - 30 uses

  • 4
    Great resource. Luckily most of the extensions and libraries above are now compiled by default with PHP 5.2.4 and above. – Chris_O Feb 18 '12 at 5:21
  • @Chris_O as long as default is followed... It's been said several times by core team that there are some weeeeird PHP configurations out there in the wild. What prompted this question from myself is that VPS was purchased at work from new hosting provider and unexpectedly it had very minimal configuration with some typical extensions missing. It would be more convenient to provide support with such check list of extensions, then discover and ask them to be installed one by one. – Rarst Feb 18 '12 at 16:14
  • Which lib is used to unzip themes and plugins? – jgraup Nov 24 '16 at 21:23
  • 1
    @jgraup ZipArchive or PclZip see related unzip functions queryposts.com/?s=unzip_file – Rarst Nov 24 '16 at 21:46
  • 1
    With v4.7 and the new native PDF thumbnail/preview your server needs Imagick, ImageMagick, and Ghostscript support. – j08691 Mar 3 '17 at 18:17

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 ...

  • Why is this no where to be found on the Wordpress website? – JedatKinports Mar 20 '17 at 9:27

(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:

  • php5-cli
  • php5-dev
  • php5-fpm
  • php5-cgi
  • php5-mysql
  • php5-xmlrpc
  • php5-curl
  • php5-gd
  • php-apc (not required, but recommended)
  • php-pear
  • php5-imap
  • php5-mcrypt
  • php5-pspell

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):

PHP modules pre-installed by Hostgator

Media Temple provides a phpinfo(); file for you to check their config. It's useful for comparison purposes too.

  • What does WP need php5-cli, php5-dev, (php5-fpm && php5-cgi), php5-pear, php5-imap, and php5-pspell for? Your approach seems to be to just install everything and it is a poor one. As is the idea that you should mimic shared hosting environments if you have control over your install. Also, you should choose one way to run PHP (FastCGI or CGI) but not both. – user55371 Jul 10 '14 at 0:50

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

<?php
/**
 * Check PHP environment.
 *
 * Usage through a webserver
 *     wget -q -O - "https://example.com/php-env-check.php"; echo
 * Usage on CLI
 *     php /path/to/php-env-check.php
 *
 * @package php-env-check
 * @version 0.2.0
 * @author Viktor Szépe <viktor@szepe.net>
 */

namespace O1;

// Local access only
if ( php_sapi_name() !== 'cli' && $_SERVER['REMOTE_ADDR'] !== $_SERVER['SERVER_ADDR'] ) {
    header( 'Status: 403 Forbidden' );
    header( 'HTTP/1.1 403 Forbidden', true, 403 );
    header( 'Connection: Close' );
    exit;
}

// Remove cached version of this file
if ( function_exists( 'opcache_invalidate' ) ) {
    opcache_invalidate( __FILE__ );
}

// Check environment
$check = new Check_Env();
$status = empty( $check->errors );

// Display report and exit
print json_encode( $check->errors );
exit( $status ? 0 : 1 );

/**
 * Check PHP configuration.
 */
final class Check_Env {

    /**
     * List of errors.
     */
    public $errors = array();

    /**
     * Run the checks.
     *
     * @param void
     */
    public function __construct() {

        // Extensions for WordPress on PHP 7.0
        // http://wordpress.stackexchange.com/a/42212

        // Engine version
        $this->assert( 'php', 70013, PHP_VERSION_ID );

        // Core directives
        $this->assert_directive( 'expose_php', '' );
        $this->assert_directive( 'allow_url_fopen', '' );
        $this->assert_directive( 'mail.add_x_header', '' );
        $this->assert_directive( 'realpath_cache_size', '64k' );
        $this->assert_directive( 'max_execution_time', '30' );
        $this->assert_directive( 'memory_limit', '128M' );
        $this->assert_directive( 'max_input_vars', '1000' );
        $this->assert_directive( 'post_max_size', '4M' );
        $this->assert_directive( 'upload_max_filesize', '4M' );

        // Compiled in Extensions
        // php -n -m | paste -s -d " "
        // Core date filter hash libxml openssl pcntl pcre Reflection session SPL standard zlib
        $this->assert_extension( 'date' );
        $this->assert_directive( 'date.timezone', 'Europe/Budapest' );
        $this->assert_extension( 'filter' );
        $this->assert_extension( 'hash' );
        $this->assert_extension( 'openssl' );
        $this->assert_extension( 'pcre' );
        $this->assert_extension( 'SPL' );
        $this->assert_extension( 'zlib' );

        // Common Extensions
        // dpkg -L php7.0-common | sed -n -e 's|^/usr/lib/php/\S\+/\(\S\+\)\.so$|\1|p' | paste -s -d " "
        // ctype iconv gettext tokenizer sockets pdo sysvsem fileinfo posix exif sysvmsg phar ftp calendar sysvshm shmop
        $this->assert_extension( 'ctype' ); // wp-includes/ID3/getid3.lib.php
        $this->assert_extension( 'posix' );
        $this->assert_extension( 'exif' ); // wp-admin/includes/image.php
        $this->assert_extension( 'ftp' );
        $this->assert_extension( 'gettext' ); // _()
        $this->assert_extension( 'iconv' );
        $this->assert_extension( 'mbstring' );
        $this->assert_extension( 'sockets' );
        $this->assert_extension( 'tokenizer' );

        // php7.0-json
        $this->assert_extension( 'json' );
        // php7.0-intl
        $this->assert_extension( 'intl' );
        // php7.0-xml
        // wddx xml simplexml xmlwriter xmlreader dom xsl
        $this->assert_extension( 'xml' );
        $this->assert_extension( 'SimpleXML' );
        $this->assert_extension( 'xmlreader' );
        $this->assert_extension( 'dom' );
        // php7.0-curl
        $this->assert_extension( 'curl' );
        // php7.0-gd
        $this->assert_extension( 'gd' );
        // php7.0-mysql
        // mysqlnd mysqli pdo_mysql
        // WP_USE_EXT_MYSQL will use mysqli through mysqlnd (no PDO)
        $this->assert_extension( 'mysqlnd' );
        $this->assert_extension( 'mysqli' );
        // php7.0-opcache
        $this->assert_extension( 'Zend OPcache', 'ext.opcache' );
        $this->assert_directive( 'opcache.restrict_api', '/home/prg123' );
        $this->assert_directive( 'opcache.memory_consumption', '256' );
        $this->assert_directive( 'opcache.interned_strings_buffer', '16' );
        $this->assert_directive( 'opcache.max_accelerated_files', '10000' );

        // Deprecated Extensions
        $this->assert_disabled_extension( 'mcrypt' );
        $this->assert_disabled_extension( 'mysql' );

        // Disabled Extensions
        // calendar fileinfo pcntl PDO pdo_mysql Phar readline
        // shmop sysvmsg(System V messages) sysvsem(System V semaphore) sysvshm(System V shared memory) wddx xmlwriter xsl

        $this->assert_disabled_extension( 'calendar' );
        $this->assert_disabled_extension( 'fileinfo' );
        $this->assert_disabled_extension( 'pcntl' );
        $this->assert_disabled_extension( 'PDO' );
        $this->assert_disabled_extension( 'pdo_mysql' );
        $this->assert_disabled_extension( 'Phar' );
        $this->assert_disabled_extension( 'readline' );
        $this->assert_disabled_extension( 'shmop' );
        $this->assert_disabled_extension( 'sysvmsg' );
        $this->assert_disabled_extension( 'sysvsem' );
        $this->assert_disabled_extension( 'sysvshm' );
        $this->assert_disabled_extension( 'wddx' );
        $this->assert_disabled_extension( 'xmlwriter' );
        $this->assert_disabled_extension( 'xsl' );
        // php7.0-sqlite3
        // pdo_sqlite sqlite3
        $this->assert_disabled_extension( 'pdo_sqlite' );
        $this->assert_disabled_extension( 'sqlite3' );

        // 3rd-party Extensions

        // php7.0-redis
        $this->assert_extension( 'igbinary' );
        $this->assert_extension( 'redis' );

        // Not for WordPress

        // Session
        $this->assert_directive( 'session.gc_maxlifetime', '1440' );
    }

    /**
     * Simple assert.
     *
     * @param $id string       Assert ID
     * @param $expected string Expected value
     * @param $result string   Current value
     */
    private function assert( $id, $expected, $result ) {

        if ( $expected !== $result ) {
            $this->errors[ $id ] = $result;
        }
    }

    /**
     * Assert for a PHP extension.
     *
     * @param $extension_name string Extension name
     * @param $id string             Optional assert ID
     */
    private function assert_extension( $extension_name, $id = '' ) {

        // Automatic ID
        if ( '' === $id ) {
            $id = 'ext.' . $extension_name;
        }
        $this->assert( $id, true, extension_loaded( $extension_name ) );
    }

    /**
     * Negative assert for a PHP extension.
     *
     * @param $extension_name string Extension name
     * @param $id string             Optional assert ID
     */
    private function assert_disabled_extension( $extension_name, $id = '' ) {

        // Automatic ID
        if ( '' === $id ) {
            $id = '!ext.' . $extension_name;
        }
        $this->assert( $id, false, extension_loaded( $extension_name ) );
    }

    /**
     * Assert for a PHP directive.
     *
     * @param $directive_name string Directive name
     * @param $expected string       Expected value
     * @param $id string             Optional assert ID
     */
    private function assert_directive( $directive_name, $expected, $id = '' ) {

        // Automatic ID
        if ( '' === $id ) {
            $id = $directive_name;
        }
        $this->assert( $id, $expected, ini_get( $directive_name ) );
    }
}

Based on the work of @rarst

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, while wp 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:

$ wp ext required
+-----------+-----------+
| extension | installed |
+-----------+-----------+
| curl      | 1         |
| date      | 1         |
| dom       | 1         |
| filter    | 1         |
| ftp       | 1         |
| gd        | 1         |
| hash      | 1         |
| iconv     | 1         |
| json      | 1         |
| libxml    | 1         |
| mbstring  | 1         |
| mysqli    | 1         |
| openssl   | 1         |
| pcre      | 1         |
| posix     | 1         |
| SimpleXML | 1         |
| sockets   | 1         |
| SPL       | 1         |
| tokenizer | 1         |
| xml       | 1         |
| xmlreader | 1         |
| zlib      | 1         |
+-----------+-----------+
Success: All required extensions are installed

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:

apt-get install php5-fpm php5-mysqlnd php5-imagick php5-curl

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:

deb http://packages.dotdeb.org jessie all
deb-src http://packages.dotdeb.org jessie all

Add the GPG key:

wget https://www.dotdeb.org/dotdeb.gpg
sudo apt-key add dotdeb.gpg

Update the "package list":

sudo apt-get update

1. Install PHP 7:

apt-get install php7.0-common libapache2-mod-php7.0 php7.0-cli

Source: http://php.net/manual/en/install.unix.debian.php

2. List of modules, which are included in the "php7.0-common" package:

/usr/lib/php/20151012/calendar.so
/usr/lib/php/20151012/ctype.so
/usr/lib/php/20151012/exif.so
/usr/lib/php/20151012/fileinfo.so
/usr/lib/php/20151012/ftp.so
/usr/lib/php/20151012/gettext.so
/usr/lib/php/20151012/iconv.so
/usr/lib/php/20151012/pdo.so
/usr/lib/php/20151012/phar.so
/usr/lib/php/20151012/posix.so
/usr/lib/php/20151012/shmop.so
/usr/lib/php/20151012/sockets.so
/usr/lib/php/20151012/sysvmsg.so
/usr/lib/php/20151012/sysvsem.so
/usr/lib/php/20151012/sysvshm.so
/usr/lib/php/20151012/tokenizer.so

Source: https://packages.debian.org/sid/amd64/php7.0-common/filelist

3. To install the additional modules which are required/recommended by wordpress:

apt-get install php7.0-curl php7.0-gd php7.0-mbstring php7.0-mcrypt php7.0-pspell php7.0-zip

Source: https://wordpress.stackexchange.com/a/42141/107878

4. I couldn't find the following on debian:

Openssl
Path Info Check
Zlib

5. "apt-cache search php7" returns:

php7.0 - server-side, HTML-embedded scripting language (metapackage)
php7.0-apcu - APC User Cache for PHP
php7.0-apcu-bc - APCu Backwards Compatibility Module
php7.0-bcmath - Bcmath module for PHP
php7.0-bz2 - bzip2 module for PHP
php7.0-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.0-cli - command-line interpreter for the PHP scripting language
php7.0-common - documentation, examples and common module for PHP
php7.0-curl - CURL module for PHP
php7.0-dba - DBA module for PHP
php7.0-dbg - Debug symbols for PHP7.0
php7.0-dev - Files for PHP7.0 module development
php7.0-enchant - Enchant module for PHP
php7.0-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
php7.0-gd - GD module for PHP
php7.0-geoip - GeoIP module for PHP
php7.0-gmp - GMP module for PHP
php7.0-igbinary - igbinary serializer for PHP
php7.0-imagick - Provides a wrapper to the ImageMagick library
php7.0-imap - IMAP module for PHP
php7.0-interbase - Interbase module for PHP
php7.0-intl - Internationalisation module for PHP
php7.0-json - JSON module for PHP
php7.0-ldap - LDAP module for PHP
php7.0-mbstring - MBSTRING module for PHP
php7.0-mcrypt - libmcrypt module for PHP
php7.0-memcached - memcached extension module for PHP, uses libmemcached
php7.0-mongodb - MongoDB driver for PHP
php7.0-msgpack - MessagePack serializer for PHP
php7.0-mysql - MySQL module for PHP
php7.0-odbc - ODBC module for PHP
php7.0-opcache - Zend OpCache module for PHP
php7.0-pgsql - PostgreSQL module for PHP
php7.0-phpdbg - server-side, HTML-embedded scripting language (PHPDBG binary)
php7.0-pspell - pspell module for PHP
php7.0-readline - readline module for PHP
php7.0-recode - recode module for PHP
php7.0-redis - PHP extension for interfacing with Redis
php7.0-snmp - SNMP module for PHP
php7.0-soap - SOAP module for PHP
php7.0-sqlite3 - SQLite3 module for PHP
php7.0-ssh2 - Bindings for the libssh2 library
php7.0-sybase - Sybase module for PHP
php7.0-tidy - tidy module for PHP
php7.0-xdebug - Xdebug Module for PHP
php7.0-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP
php7.0-xmlrpc - XMLRPC-EPI module for PHP
php7.0-xsl - XSL module for PHP (dummy)
php7.0-zip - Zip module for PHP

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.

  • 2
    WP doesn't use the PDO layer. There are probably plugins that enable you to do this, but WP's database API is still from the ancient times of PHP... – onetrickpony Feb 13 '12 at 18:36

protected by Community Oct 13 '17 at 14:56

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.