"PHP Startup: Unable to load dynamic library" errors appear when PHP tries to load a module (.so file) that doesn't exist, is compiled for a different PHP version, or has dependency issues. These errors typically show up in Apache error logs, cPanel's error log viewer, or in a customer's error_log file and can affect page load times even if the site still functions.
The error message tells you exactly which module is failing: Unable to load dynamic library '/opt/cpanel/ea-php82/root/usr/lib64/php/modules/imagick.so'. Check if that file exists with ls -la on the path shown. If it doesn't, the module needs to be reinstalled for that PHP version.
01. Identifying the Problem Module
# Find all PHP startup errors in the main error log
grep "Unable to load dynamic library" /var/log/apache2/error_log | tail -20
# Check a specific account's error log
grep "Unable to load dynamic library" /home/username/logs/error.log
# List what modules PHP is trying to load vs what's available
/opt/cpanel/ea-php82/root/usr/bin/php -m 2>&1 | head -30
The error includes the full path to the .so file, which tells you both the PHP version (ea-php82) and the module name (imagick.so).
02. Common Causes
Module not installed for this PHP version - The module is enabled in the account's PHP configuration but the .so file was never installed (or was removed during a PHP update). Reinstall it via WHM or yum.
PHP version mismatch - The account switched PHP versions but the old version's module references stayed in the configuration. Modules compiled for PHP 8.1 won't load in PHP 8.2.
EasyApache rebuild removed the module - Running an EasyApache 4 profile that doesn't include the module will remove the .so file while leaving config references intact.
CloudLinux PHP Selector conflict - The account is using CloudLinux's alt-PHP but some module references still point to EA-PHP paths.
03. Fixing Per-Account Issues
If the error only affects specific accounts:
# Check what PHP version the account uses
grep -l "username" /etc/apache2/conf.d/userdata/std/2_4/username/*.conf
# Check which modules the account has enabled
cat /home/username/.php/php.ini 2>/dev/null
# Or check CloudLinux selector settings
selectorctl --user=username --print-extensions
If the account's custom php.ini or CloudLinux selector is referencing a module that doesn't exist, either install the module or remove the reference:
# Remove the extension from the user's local php.ini
# (the specific line like: extension=imagick.so)
# Or disable it via CloudLinux selector
selectorctl --user=username --disable-extension=imagick
04. Fixing Server-Wide Issues
If multiple accounts show the same error, the module needs to be installed at the server level:
# Install a missing PHP module via yum (example: imagick for PHP 8.2)
yum install ea-php82-php-pecl-imagick
# List available modules for a PHP version
yum list available ea-php82-php-*
# Verify the module is now loadable
/opt/cpanel/ea-php82/root/usr/bin/php -m | grep imagick
After installing, restart Apache and PHP-FPM:
systemctl restart httpd
systemctl restart ea-php82-php-fpm
05. CloudLinux PHP Selector
If accounts use CloudLinux's PHP Selector (alt-php) instead of EA-PHP, modules are managed differently:
# List available extensions for alt-php82
selectorctl --list-extensions --version=8.2
# Install a missing extension
selectorctl --install-extension=imagick --version=8.2
# Check which version an account is using
selectorctl --user=username --summary
After switching an account between EA-PHP and CloudLinux alt-PHP (or between PHP versions), run /usr/local/cpanel/scripts/rebuildhttpdconf && systemctl restart httpd to ensure the configuration is consistent.
Need Help?
If you're seeing these errors across multiple accounts after a PHP update, open a ticket with the specific module name and PHP version.
Open a Support TicketQuick Recap: PHP Dynamic Library Errors
- Read the error message - It tells you the exact module and PHP version
- Check if the .so file exists - If not, install the module via yum or selectorctl
- Check PHP version match - Modules must be compiled for the active PHP version
- Remove stale references - Clear module references from user php.ini if the module isn't needed
- Restart services - Restart Apache and PHP-FPM after making changes
Last updated March 2026 · Browse all Server Maintenance articles
