Wordpress - What are PHP extensions and libraries WP needs and/or uses?

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


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:

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

Tags:

Php

Server