Installing required WordPress extensions for PHP 8.

In this guide, we are going to show you how to install certain PHP 8 extensions for WordPress.

Note that this guide is for Ubuntu and other Debian servers.

In the “Site Health” section on WordPress, you may see recommendations about how you should install modules such as dom, gd, mbstring and zip.

These extensions can be important. This is because WordPress may have to do “extra work” in their absence. Furthermore, certain features might not work at all if the relevant module is missing.

Therefore, it is usually a good idea to install them if you can.

The minor release number should be included in most of these installation commands.

In the commands below, you will notice that we are using 8.0. This is the version and the minor release number.

Installing extensions for PHP 8

8 is the version, or “major release”. The 0 is the “minor release”.

When installing these modules, you will need to be specific about which minor release of PHP you are using.

For example, if you are using PHP 8.1, then you will need to replace 8.0 with 8.1. If you are using 8.2, then you will need to replace 8.0 with 8.2.

You get the point.

Installing GD on PHP 8.

To install GD on PHP 8, you can run the following command.

sudo apt install php8.0-gd

If you are using PHP 8.1, 8.2 or 8.3, etc, then you will need to modify the command above.

For example, if you are installing GD for PHP 8.4, then you will need to use php8.4-gd instead of php8.0-gd.

As you can see, the minor release number must be included.

Installing DOM on PHP 8.

To install DOM on PHP 8, you can just install the XML extension.

sudo apt install php8.0-xml

Once again, I must point out that you will need to modify the command above to meet the version of PHP that you are running.

Installing ZIP on PHP 8.

WordPress uses the ZIP library to handle plugins. Therefore, it makes sense to enable it.

sudo apt install php8.0-zip

How to install imagick.

Unfortunately, at the time of writing, imagick does not support PHP 8. However, this is likely to change.

Luckily enough, imagick is not an essential module for WordPress. It basically just provides better quality image manipulation.

If you are reading this guide “from the future”, then you can try the following.

sudo apt install php8.0-imagick

Let us know if the above command works for you.

Installing mbstring on PHP 8.

To install mbstring on PHP 8, you can use the following command.

sudo apt install php8.0-mbstring

This module is pretty important as WordPress uses it to properly handle UTF8 text.

Conclusion.

The above commands should enable most of the required PHP modules for WordPress. The other extensions are usually already enabled by default.

If you think that we have omitted an important extension that is not enabled by default in PHP 8, then be sure to post a comment below.