Adding/enabling missing PHP modules in WordPress

WordPress has a health check for your site. You can see a summary of the results of the check on your dashboard. This is the results of mine since updating to WordPress 5.9:

Site Health Status for pandammonium.org: it’s good, but it’s not right

It’s good, to paraphrase the late Roy Walker [1], but it’s not right: there’s one item that needs my attention. Clicking the Site Health screen link takes me to, surprisingly enough, the Site Health screen, which you can go to directly at http(s)://example.com/wp-admin/site-health.php.

Site Health Status: an optional module is missing

My health screen shows me that One or more recommended modules are missing, specifically that:

The optional module, intl, is not installed, or has been disabled.

This is an internationalisation module [2], apparently.

I went to my trusty command line, and attempted to use apt install intl to install this missing module. However, I was thwarted:

sudo apt install intlReading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package intl

It seemed I had the name of the package wrong, despite using the name given in the list of optional PHP modules recommended by WordPress [3]. I rummaged around the internet and found an indication of how to install it from the comments on the PHP page for installing the intl package [4]: the module name must be prefixed with PHP and its version number:

sudo apt install php7.4-intlReading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  php7.4-intl
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 126 kB of archives.
After this operation, 528 kB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 php7.4-intl amd64 7.4.27-1+ubuntu20.04.1+deb.sury.org+1 [126 kB]
Fetched 126 kB in 0s (5,992 kB/s)
Selecting previously unselected package php7.4-intl.
(Reading database ... 158803 files and directories currently installed.)
Preparing to unpack .../php7.4-intl_7.4.27-1+ubuntu20.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.4-intl (7.4.27-1+ubuntu20.04.1+deb.sury.org+1) ...
Setting up php7.4-intl (7.4.27-1+ubuntu20.04.1+deb.sury.org+1) ...

Creating config file /etc/php/7.4/mods-available/intl.ini with new version
Processing triggers for libapache2-mod-php7.4 (7.4.27-1+ubuntu20.04.1+deb.sury.org+1) ...
Processing triggers for php7.4-cli (7.4.27-1+ubuntu20.04.1+deb.sury.org+1) ...

I expected it to work after that, but I got the same error. I looked in phpinfo.php [5], and it wasn’t there either, although it was listed as being installed [6].

One of the comments on [4] said that I should uncomment out the intl package (by deleting the semi-colon ;) on the appropiate line of php.ini then restart the Apache server:

- open your php.ini file    c:/xampp/php/php.ini or search how to find it, it's up to your server.
- find ;extension=php_intl.dll
- remove the comment ;
- restart apache
- then it's working :)

I used the same when I have problem in any extensions, open php.ini then search for the extension then remove the comment.
Edit php.ini, then restart (reload) Apache (it’s been downvoted, which is why it’s so faint; I found it the most useful piece of information on the whole page)

I found the file [7] and followed the instructions, adapting them for Ubuntu rather than Windows, and reloading Apache, rather than restarting it [8]:

sudo nano /etc/php/7.4/apache2/php.ini
[…]
;extension=gmp
extension=intl
;extension=imap
[…]
sudo service apache2 reload

Then I looked in phpinfo.php again; lo and behold, there it was:

The phpinfo.php file now shows the PHP intl package

This seemed promising; I looked back at the Site Health screen: the error had gone, and WordPress was very happy about it:

WordPress is happy that there are no warnings/errors to show on the Site Health screen

References

  1. https://en.wikipedia.org/wiki/Roy_Walker_(comedian)
  2. https://www.php.net/manual/en/book.intl.php
  3. https://make.wordpress.org/hosting/handbook/server-environment/#php-extensions
  4. https://www.php.net/manual/en/intl.installation.php
  5. https://phpinfofile.com/
  6. https://stackoverflow.com/questions/478844/how-do-i-see-the-extensions-loaded-by-php
  7. https://webrewrite.com/through-command-line-how-i-find-php-ini-file-in-linuxubuntu-and-how-to-edit-it/
  8. https://pandammonium.org/nobody-panic-but-php-is-missing-the-mysql-extension-which-is-required-by-wordpress/#the-solution

Add a comment?

This site uses Akismet to reduce spam. Learn how your comment data is processed.