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.
- 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
php -m
To get a quick searchable list:
php -m | sort
Extensions commonly needed by WordPress
This is a practical baseline for typical WordPress sites.
| Extension | Why it matters | Package name (varies) |
|---|---|---|
mysqli or pdo_mysql | Database connectivity | php-mysql / php82-php-mysqlnd |
curl | HTTP requests (updates, APIs) | php-curl |
mbstring | UTF-8 string handling | php-mbstring |
gd or imagick | Image resizing/thumbnails | php-gd / php-imagick |
zip | Plugin/theme ZIP installs | php-zip |
xml | XML parsing (feeds, some plugins) | php-xml |
exif | Image metadata (optional) | php-exif |
intl | Locale/collation (optional) | php-intl |
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
- Debian/Ubuntu
- RHEL/Rocky/Alma
- OpenLiteSpeed (lsphp)
For Ubuntu/Debian, packages are usually named php-<ext> (or php8.x-<ext> if you use versioned packages).
sudo apt update
sudo apt install -y \
php-mysql \
php-curl \
php-mbstring \
php-gd \
php-zip \
php-xml \
php-intl \
php-exif
On RHEL-family distros you may have module streams or third-party repos. Packages are commonly php-<ext>.
sudo dnf install -y \
php-mysqlnd \
php-curl \
php-mbstring \
php-gd \
php-zip \
php-xml \
php-intl
With OpenLiteSpeed, you often install lsphp packages (example uses PHP 8.2 naming; adjust to your version).
sudo apt update
sudo apt install -y \
lsphp82 \
lsphp82-mysql \
lsphp82-curl \
lsphp82-mbstring \
lsphp82-gd \
lsphp82-zip \
lsphp82-xml
Reload services
Reload the PHP handler used by your web server.
- PHP-FPM
- Apache + mod_php
- OpenLiteSpeed
sudo systemctl reload php8.2-fpm
sudo systemctl reload apache2
sudo systemctl reload lsws
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
php -m shows the module but WordPress still errors | Web server uses a different PHP binary | Verify PHP handler (FPM vs lsphp) and install extensions for that version |
Class "ZipArchive" not found | zip extension missing | Install php-zip and reload PHP |
| Image uploads fail or no thumbnails | gd/imagick missing | Install php-gd or php-imagick |