Skip to content

Include all recommended WordPress libraries

The web team (cc @ldelpian and @agonzalv) have identified our image is leaner than the upstream recommended image.

to my mind we should, at least mimic the default version and include the libraries of this section install the PHP extensions we need (https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions)

@fborgesa looked into this and it seems we need to include at least the libraries in https://github.com/docker-library/wordpress/blob/470084224c4a2b4f0c2e19da2af9ab96298739e4/latest/php8.2/fpm/Dockerfile

To do:

Done:

Highly recommended libraries from WP

Library Description Already Present Why is Needed
curl Performs remote request operations. (PHP >= 7.3 requires libcurl >= 7.15.5; PHP >= 8.0 requires libcurl >= 7.29.0 ; PHP >= 8.4 requires libcurl >= 7.61.0) -
dom Used to validate Text Widget content and to automatically configure IIS7+. (requires libxml) -
exif Works with metadata stored in images. (requires php-mbstring) Must Handling metadata on the image.WP is including it by default
fileinfo Used to detect mimetype of file uploads. (bundled in PHP) -
hash Used for hashing, including passwords and update packages. (bundled in PHP >=5.1.2) -
igbinary Increases performance as a drop in replacement for the standard PHP serializer. Not needed at the moment Performance increasing lib. WP is not including it by default.
imagick Provides better image quality for media uploads. Smarter image resizing (for smaller images) and PDF thumbnail support, when Ghost Script is also available. (requires ImageMagick >= 6.2.4) ⚠️ Nice to have Ensuring better quality and compression of images is one of the priorities regarding accessibility. WP is including it by default in their image.
intl Enable to perform locale-aware operations including but not limited to formatting, transliteration, encoding conversion, calendar operations, conformant collation, locating text boundaries and working with locale identifiers, timezones and graphemes. (PHP >= 7.4.0 requires ICU >= 50.1) ⚠️ Nice to have Operations done regularly, specially dormatting and calendar. WP is including it by default in their image.
mbstring Used to properly handle UTF8 text. -
openssl SSL-based connections to other hosts. (PHP 7.1–8.0 requires OpenSSL >= 1.0.1 / < 3.0; PHP >= 8.1 requires OpenSSL >= 1.0.2 / < 4.0; PHP >= 8.4 requires OpenSSL >= 1.1.1 / < 4.0) -
pcre Increases performance of pattern matching in code searches. (bundled in PHP >= 7.0, recommended PCRE 8.10) -
xml Used for XML parsing, such as from a third-party site. (requires libxml) -
zip Used for decompressing Plugins, Themes, and WordPress update packages. (requires libzip >= 0.11; recommended libzip >= 1.6) ⚠️ Nice to have We have unzip enabled, we should have also the counterpart enabled. WP is including it by default in their image.

PHP modules WordPress may use in certain situations

In our case, most of them are related to image manipulation.

Library Description Already Present Why is Needed
Ghostscript powerful interpreter for PDF and PostScript files, and is widely used for: Rendering PDFs or PostScript files into images (like JPEG, PNG), Converting between PDF, PostScript, and image formats, Generating previews or thumbnails of PDF pages. Extracting or rasterizing pages from multipage documents ⚠️ Nice to have. Probably in the future we will have previews of pdf files, WP it's including it by default on their image.
gd extensions .avif .webp graphics software library for dynamically creating and manipulating images. ⚠️ Partially, only jpeg and free type Must. It Allows users to upload images with the following extensions .avif .webp
bcmath For arbitrary precision mathematics, which supports numbers of any size and precision up to 2147483647 decimal digits. ⚠️ Nice to have. Probably can be useful if we develop some kind of plugin for handling physics results. WP it's including it by default on their image.
Edited by Lorenzo Del Pianta