In this lunchtime WPQuickies, I’ll be listing the required PHP extensions that WordPress needs to run properly.
How Do WordPress and PHP Work Together?
Here’s a diagram of a very simplified WordPress PHP stack.
WordPress is an event-driven app built in PHP.
PHP is a dynamic language that compiles code in real-time to generate HTML as an output.
For the WordPress stack, most of the dynamic data come from functions and a database.
The output is sent to the webserver and along with static assets such as image files, CSS files, JavaScript files, the web server creates the final full web page and sends that back to the requesting browser.
What Are PHP Extensions?
Similarly to extending WordPress core functionality by installing plugins, the core PHP programming language can gain additional functionality by using extensions.
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
On other operating systems, you can look directly in the php.ini configuration file to locate the extensions directory.
How Many PHP Extensions Exist?
According to the PHP documentation ref: there are 176 officially documented PHP extensions.
- Apache
- APCu
- Arrays
- BC Math
- Bzip2
- Calendar
- Classes/Objects
- CommonMark
- COM
- Componere
- CSPRNG
- Ctype
- CUBRID
- cURL
- Date/Time
- DBA
- dBase
- Direct IO
- Directories
- DOM
- Data Structures
- Eio
- Enchant
- Error Handling
- Ev
- Event
- Exif
- Expect
- FANN
- FrontBase
- FDF
- FFI
- Fileinfo
- Filesystem
- Filter
- FastCGI Process Manager
- FTP
- Function Handling
- GD
- Gearman
- Gender
- GeoIP
- Gettext
- Gmagick
- GMP
- GnuPG
- Hash
- HRTime
- Firebird/InterBase
- IBM DB2
- iconv
- ImageMagick
- IMAP
- PHP Options/Info
- Program execution
- Inotify
- intl
- JSON
- LDAP
- libxml
- Lua
- LuaSandbox
- LZF
- Mailparse
- Math
- Multibyte String
- McryptMemcache
- Memcached
- Mhash
- Misc.
- mqseries
- MySQL (Original)
- Mysql_xdevapi
- MySQLi
- Mysqlnd
- Network
- OAuth
- OCI8
- OPcache
- OpenAL
- OpenSSL
- Output Control
- parallel
- Parle
- Password Hashing
- PCNTL
- PCRE
- PDO
- CUBRID (PDO)
- MS SQL Server (PDO)
- Firebird (PDO)
- IBM (PDO)
- Informix (PDO)
- MySQL (PDO)
- Oracle (PDO)
- ODBC and DB2 (PDO)
- PostgreSQL (PDO)
- SQLite (PDO)
- MS SQL Server (PDO)
- PostgreSQL
- Phar
- phpdbg
- pht
- POSIX
- PS
- Pspell
- pthreads
- Radius
- Rar
- Readline
- Recode
- Reflection
- RpmInfo
- RRD
- runkit7
- ScoutAPM
- Seaslog
- Semaphore
- Sessions
- Shared Memory
- SimpleXML
- SNMP
- SOAP
- Sockets
- Sodium
- Solr
- SPL
- SQLite3
- SQLSRV
- ssdeep
- SSH2Stomp
- Streams
- Strings
- SVM
- SVN
- Swoole
- Sync
- Taint
- TCP
- Tidy
- Tokenizer
- Trader
- UI
- ODBC
- uopz
- URLs
- V8js
- Variable handling
- Varnish
- WDDX
- win32service
- WinCache
- wkhtmltox
- xattr
- xdiff
- Xhprof
- XLSWriter
- XML Parser
- XMLDiff
- XMLReader
- XML-RPC
- XMLWriter
- XSL
- Yac
- Yaconf
- Yaf
- Yaml
- Yar
- YAZ
- Zip
- Zlib
- 0MQ messaging
- ZooKeeper
What PHP Extensions Are Needed For WordPress?
According to the WordPress handbook, WordPress needs:
- 13 official PHP extensions for core functionality (pink)
- 9 official PHP extensions for fallback functions (orange)
- 3 official PHP extensions if files are non-writable on the server (yellow)
- 1 non-official PHP extension (blue)
What Do These PHP Extensions Do?
Here’s what these core PHP extensions do.
- curl
Performs remote request operations. - dom
Used to validate Text Widget content and to automatically configure IIS7+. - exif
Works with metadata stored in images. - fileinfo
Used to detect mime type of file uploads. - hash
Used for hashing, including passwords and update packages. - imagick
Provides better image quality for media uploads. - json
Used for communications with other servers. - mbstring
Used to properly handle UTF 8 text. - mysqli
Connects to MySQL for database interactions. - openssl
Permits SSL-based connections to other hosts. - pcre
Increases performance of pattern matching in code searches. - sodium
Validates Signatures and provides secure random bytes. - xml
Used for XML parsing, such as from a third-party site. - zip
Used for decompressing Plugins, Themes, and WordPress update packages.
Fallback PHP Extensions
These are fallback PHP extensions, used if the core extensions are not implemented – i.e. perhaps you are running an out-of-date PHP version.
- bcmath
For arbitrary precision mathematics. - filter
Used for securely filtering user input. - gd
If Imagick isn’t installed, the GD Graphics Library is used - iconv
Used to convert between character sets. - intl
Enable to perform locale-aware operations. - mcrypt
Generates random bytes when libsodium and /dev/urandom aren’t available. - simplexml
Used for XML parsing. - xmlreader
Used for XML parsing. - zlib
Gzip compression and decompression.
PHP Extensions Used For File Changes
These PHP extensions are used when the file system can’t modify a file directly.
- ssh2
Provide access to remote machine resources (shell, remote exec, file transfer) - ftp
Implement client access to files servers speaking the File Transfer Protocol (FTP). - sockets
Implements a low-level interface to the socket communication functions
#WPQuickies
Join me every Thursday at 1 pm Sydney time for some more WPQuickies – WordPress tips and tricks in thirty minutes or less.
Broadcasting live on YouTube and Facebook.
Suggest a #WPQuickies Topic
If you have an WordPress topic you’d like to see explained in 30 mins or under, fill out the form below.
https://forms.gle/mMWCNd3L2cyDFBA57
Watch Previous WPQuickies
Looking to level up your WordPress development skills?
I self-taught myself WordPress development, but this book took it to another level.
Each chapter builds upon the next, but you can also use it to jump into specific areas like WP Cron, WP REST endpoints, building a custom plugin repository etc.
If you’re like me and like having reference books at hand, this is the one that sits on my desk all the time.