Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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...
share|improve this question

5 Answers 5

up vote 31 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

share|improve this answer
2  
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
    
@Rarst Mind sharing your report code? I was thinking of a plugin that can either generate this list if possible or fetch it according to your WP version (I can host) and show the diff between the list and what you have installed. Personally, the lack of GD on some bare VPS:es has given me headache more than once. There are no errors reported, you just don’t get any thumbnails generated. –  Per Wiklander Mar 7 '12 at 2:20
1  
@Per Wiklander note that what you currently see is major manual cleanup of raw data to make pretty human-friendly answer :) Here is code that was used to generate original raw data version. –  Rarst Mar 7 '12 at 11:17
1  
@01100001 I cleaned up raw data for an answer manually and it wasn't fun, not doing it again. I don't expect it change much so don't feel a need (so far) to completely automate and re-run such report. Code to get raw data linked above if you are interested. –  Rarst Feb 9 '13 at 14:50

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

share|improve this answer

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

share|improve this answer
    
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. –  Tom Dworzanski Jul 10 at 0:50

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
share|improve this answer

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.

share|improve this answer
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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