Every new hosting plan ordered during APR2019 can request free DNSSEC setup ($39 value). Use coupon APR2019 for free DNSSEC ($39 value).
Dominate local SEO with a regional SlickStack cloud server for just $39/month! Order Now
250,000+ sites use our plugins! Become A Member

Required PHP 7.2 Extensions For WordPress

Jesse Nickles   |  19 Jun, 2019

For years now, WordPress and PHP have been best buddies. Despite WordPress technically being a sub-framework built on top of PHP (with its own unique coding style, hooks, filters, and so forth), its reliance on underlying PHP functions has always been critical to steering WordPress development.

A few years ago, before PHP 7 came out, there was chatter among developer circles that javascript frameworks were taking over the internet and that PHP itself might soon be a thing of the past. Well, clearly this fear-mongering was not an accurate picture of the future as PHP 7 has pushed rapidly into the future with renewed focus on namespaces, object oriented coding (OO) and tons of new features and incredible performance. In fact, less PHP extensions are now required by WordPress to be installed than in the past, partly because more features are now built-in to PHP itself, and partly because WP is more self-reliant and intuitive these days.

“WordPress core makes use of PHP extensions. If the preferred extension is missing WordPress will either have to do more work to do the task the module helps with or, in the worst case, will remove functionality.”

 

WordPress Handbook

Reading Between The Lines To Find Best PHP Extensions

Most quality web hosting companies should already know what PHP extensions to install in order for WordPress to function optimally. But in some cases, a web host is using severely outdated documentation. In other cases, you might be setting up your own web server, such as a LEMP or LAMP stack, and you need to know what PHP extensions to install. Because LittleBizzy is built on top of SlickStack, all of these “required” and “recommended” PHP extensions are already installed for our hosting clients. You can also check out the free SlickStack script if you want a quick and easy way to setup your own WordPress server that works out-of-the-box.

Keep in mind that on Ubuntu servers when you run install php7.2 it includes the following by default (and if you’re on Ubuntu 18.04 then you can use install php instead):

libapache2-mod-php7.2
php7.2
php7.2-cli
php7.2-common
php7.2-json
php7.2-opcache
php7.2-readline

If you are installing a LEMP (Nginx) server and have no need for Apache, use install php-fpm instead:

php7.2-cli
php7.2-common
php7.2-fpm
php7.2-json
php7.2-opcache
php7.2-readline

Aah… that looks much, much better… Nginx ftw ;)

So now let’s compare the recommended list of PHP extensions with a few things. First, is it installed already? Second, is it really necessary? Here’s the official list of recommended PHP extensions:

curl -- Performs remote request operations.
dom -- Used to validate Text Widget content and to automatically configuring IIS7+.
exif -- Works with metadata stored in images.
fileinfo -- Used to detect mimetype of file uploads.
hash -- Used for hashing, including passwords and update packages.
json -- Used for communications with other servers.
mbstring -- Used to properly handle UTF8 text.
mysqli -- Connects to MySQL for database interactions.
libsodium -- Validates Signatures and provides securely random bytes.
openssl -- Permits SSL-based connections to other hosts.
pcre -- Increases performance of pattern matching in code searches.
imagick -- Provides better image quality for media uploads. See WP_Image_Editor is incoming! for details. Smarter image resizing (for smaller images) and PDF thumbnail support, when Ghost Script is also available.
xml -- Used for XML parsing, such as from a third-party site.
zip -- Used for decompressing Plugins, Themes, and WordPress update packages.

WordPress.org also lists the following as fallback/optional extensions:

filter -- Used for securely filtering user input.
gd -- If Imagick isn’t installed, the GD Graphics Library is used as a functionally limited fallback for image manipulation.
iconv -- Used to convert between character sets.
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.

Therefore rather than simply copying the recommended list from WordPress.org, which is aimed more at PHP 5.6 users and a general array of server environments, we’ve researched extensively to produce the below list of extensions you should install on PHP 7+ servers — with a focus on Ubuntu servers.

Complete Recommendations For PHP 7.2 Extensions

As you can see, knowing which PHP extensions to install for your WordPress stack might depend on your operating system, PHP version, and whether you are using Nginx (alone) and/or Apache as your server. Therefore, the final solution might be slightly different in each case — however, if you are using SlickStack (or any other LEMP stack), then we recommend installing the below list of extensions for PHP 7.2:

Last updated: Feb 6, 2020

bcmath -- used by several plugins for mathematic calculations
cli -- used for shell-based scripts and commands (included in php-fpm installation)
common -- several general sub-modules (included in php-fpm installation)
curl -- used for many remote server requests
dom -- for validating certain textual content (included in the xml extension now)
fileinfo -- detects basic MIME type info for file uploads (included in php7.2-common installation)
filter -- used for securely filtering user input (included in php7.2-common installation)
hash -- for various hashing (included in php7.2-common installation)
fpm -- performant PHP engine used by LEMP/Nginx servers (included in php-fpm installation)
gd -- backup WordPress image extension in case of issues with Imagick
iconv -- used to convert between character sets (included in php7.2-common installation)
imagick -- preferred WordPress image extension for media resizing, thumbnails, etc.
json -- for remote server communication (included in php-fpm installation)
libsodium -- validates signatures and generates random bytes
mbstring -- used to properly handle UTF8 text
mysql -- "improved" (mysqli) MySQL interface merged into this Ubuntu package
openssl -- permits SSL-based server connections (included in php7.2-common installation)
pcre -- 
opcache -- Zend OPcode caching for PHP scripts (included in php-fpm installation)
readline -- used for CLI related functions (included as part of php-fpm installation)
simplexml -- not needed if you have xml module installed
soap
xml -- for various XML parsing
xmlreader -- not needed if you have xml module installed
zip
zlib -- not recommended (gzip should be done by the server)

The following extensions are officially recommended by we do not recommend them:

  • exif
  • mcrypt (deprecated)

    Thus you’ll find the following install command in SlickStack for Ubuntu 18.04 servers:

    sudo apt install php7.2-fpm php7.2-bcmath php7.2-curl php7.2-gd php7.2-imagick php7.2-libsodium php7.2-mbstring php7.2-mysql php7.2-soap php7.2-xml php7.2-zip

    Or a simpler way to say this in Ubuntu 18.04:

    sudo apt install php-fpm php-bcmath php-curl php-gd php-imagick php-libsodium php-mbstring php-mysql php-soap php-xml php-zip

    https://varyingvagrantvagrants.org/docs/en-US/references/php-extensions/

    https://core.trac.wordpress.org/ticket/47454

    https://devanswers.co/installing-php-nginx-ubuntu-18-04/

    https://thishosting.rocks/install-php-on-ubuntu/

    Tags: ,

    Last modified: 7 Feb, 2020https://www.littlebizzy.com/?p=29941

    Results For Local Business, High Traffic, And E-Commerce.

    Local Business

    "After being hosted on GoDaddy for years, I didn't realize how negatively it was impacting my search traffic. Soon after moving to LittleBizzy, my homepage went from page 3 on Google to #1 world-wide for my target market, and I also reached the top 3 on Google Maps, with no additional SEO work."

    Juliette S.

    High Traffic

    "Before moving to LittleBizzy, whenever our news website was featured on the Drudge Report, it often slowed to a crawl or even froze up during big traffic spikes. Now, that never happens anymore, and we've been able to focus on publishing more articles instead of worrying about our web hosting."

    Tony H.

    E-Commerce

    "The research by Amazon is definitely true, because our slow WooCommerce store was bleeding sales. After LittleBizzy stabilized our performance and moved us closer to our target customers, we saw a measurable improvement in shopping cart checkouts, esp. during holidays... much better!"

    Mohammed H.

    No contracts, free migration, and free SSL forever. What are you waiting for? Order Hosting Now.

    WordPress Gossip, Technical SEO News, And Other Goodies.

    Free. Unsubscribe anytime.

    Brands That Trust Our Software: