Skip to main content

PHP Modules for WordPress (php -m)

WordPress core and common plugins depend on specific PHP extensions. If an extension is missing, you may see blank pages, plugin install failures, image processing errors, or the inability to connect to the database.

Quick Summary
  • List modules with php -m (CLI) and confirm the web server PHP has the same extensions.
  • Install the missing extension packages for your PHP version.
  • After installing extensions, reload PHP (FPM/Apache/OLS) so the web server picks them up.

Check what is installed

list-php-modules.sh
php -m

To get a quick searchable list:

list-php-modules-sorted.sh
php -m | sort

Extensions commonly needed by WordPress

This is a practical baseline for typical WordPress sites.

ExtensionWhy it mattersPackage name (varies)
mysqli or pdo_mysqlDatabase connectivityphp-mysql / php82-php-mysqlnd
curlHTTP requests (updates, APIs)php-curl
mbstringUTF-8 string handlingphp-mbstring
gd or imagickImage resizing/thumbnailsphp-gd / php-imagick
zipPlugin/theme ZIP installsphp-zip
xmlXML parsing (feeds, some plugins)php-xml
exifImage metadata (optional)php-exif
intlLocale/collation (optional)php-intl
note

Exact package names depend on distro and PHP version. The goal is to install the extension for the PHP version your web server uses.

Install missing modules

For Ubuntu/Debian, packages are usually named php-<ext> (or php8.x-<ext> if you use versioned packages).

install-wordpress-php-extensions-apt.sh
sudo apt update
sudo apt install -y \
php-mysql \
php-curl \
php-mbstring \
php-gd \
php-zip \
php-xml \
php-intl \
php-exif

Reload services

Reload the PHP handler used by your web server.

reload-php-fpm.sh
sudo systemctl reload php8.2-fpm

Troubleshooting

SymptomLikely causeFix
php -m shows the module but WordPress still errorsWeb server uses a different PHP binaryVerify PHP handler (FPM vs lsphp) and install extensions for that version
Class "ZipArchive" not foundzip extension missingInstall php-zip and reload PHP
Image uploads fail or no thumbnailsgd/imagick missingInstall php-gd or php-imagick