Many people report variations of the warning/error messages below. I’m explaining here what causes this, how to fix it quickly, and what WP Engine can do to address it in Local.
PHP Warning:
Failed loading Zend extension
PHP Startup: Unable to load dynamic library
If you just want a fast solution and no explanation, jump down to ;TL/DR; below and you’re done!
I’ve provided related text and a screenshot at the bottom of this post for your reference and to get hits from searches on this site and from search engines.
The errors occur when we upgrade Local. That is, you have a WordPress site that’s running. You upgrade local, and then your sites don’t start and you have one or more of these warnings.
In any version X of Local we use the PHP selector on each site to select a PHP version, for example v7.4.1. This results in site config files saving the current version of PHP that has been configured into this version of Local. So you might get “v7.4.1+6”. That specific release ID becomes a part of the file tree where a search is performed to get the resources for that specific version. For example:
C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-7.4.1+6/bin/win64/ext\php_xdebug.dll
OK, so now you upgrade to version Y of Local where they have done us the favor of upgrading PHP to the very latest patch set, now 7.4.1+7. You probably see this coming now…
Your site configs don’t get updated in an application update. Most good vendors don’t touch config files unless they really need to do so. Site configs are (usually) only updated when you actually make changes to your sites.
So you open Local, go to the site, attempt to start, and you see a huge blob (packed into a single line?) of warnings. You search Google, you search here, and you find the recommendation to change your PHP version to “something else”, then change it back to what you want. Yay! Problem solved.
What’s happening?
The warnings appear because your site config still has …/7.4.1+6/…, but the Local update deleted the folder and files related to that version, and replaced them with …/7.4.1+7/… Your config is looking for a folder that no longer exists.
As noted above, you solve the problem by changing the PHP for the site config to maybe 8.1.9, and then saving. It doesn’t matter which version you change to. Saving now updates the config file with the current 8.1.9+something version that’s currently configured with Local.
But you don’t want 8.1, you want 7.4. So you change the PHP back to “7.4.1”. It looks the same as it did before. But when you save, your site config now has that more detailed “7.4.1+7”. The site starts now with no warnings because it can find the 7.4.1+7 folder.
Summary so far
After updating Local, if your site doesn’t start, the suggetion has been to change the PHP version, start/stop the site, change back, and restart the site. It should start OK. But it can be even easier…
;TL/DR;
Just toggle the One-click admin off/on (see screenshot). Whenever this is turned on it regenerates php.ini from php.ini.hb. That pulls in a new value for the placeholder {{extensionsDir}}. So the site starts up with the new correct version and no more warnings.
Now for our friends at WP Engine / LocalWP / Flywheel…
I understand that auto-modifying configuration data is precarious. So please offer options to address this known issue as elegantly as possible.
- Maybe change the color of a local site name if the configured PHP version doesn’t match the currently installed/supported version. That way we can get advance warning that manual intervention is required.
- Or when a site generates warnings for failed extensions, regenerate php.ini from php.ini.hb (it just needs to refresh {{extensionsDir}}, and if the warnings disappear, just log that event and forget about it.
- Maybe offer a switch to disable that behavior on one site or all.
- Maybe display a note on the page that you’ve done this for us, and clear the note when manually dismissed.
- Maybe this can be done before starting a site, with a check to see if the extension_dir is no longer valid in a site’s /conf/php/php.ini.hbs, and if not regenerate php.ini. There won’t be any config changes, only php.ini will get updated with the current extension_dir=“{{extensionsDir}}”.
- Maybe that’s a nice new optional feature: Auto-generate php.ini for any site on the first read where the saved version of Local doesn’t match the current version.
Supporting info
Example screenshot
Again, for search engines and reference, here is the relevant text from one of my sites, from …/Local/site_name/logs/php/error.log
PHP Warning: Failed loading Zend extension 'php_xdebug.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_xdebug.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_xdebug.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_curl.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_curl.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_curl.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_gettext.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_gettext.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_gettext.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_openssl.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_openssl.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_openssl.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_exif.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_exif.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_exif.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_gd.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_gd.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_gd.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_ftp.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_ftp.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_ftp.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_imap.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_imap.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_imap.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_bz2.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_bz2.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_bz2.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_mbstring.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_mbstring.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_mbstring.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_sodium.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_sodium.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_sodium.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_tidy.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_tidy.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_tidy.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_xsl.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_xsl.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_xsl.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_soap.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_soap.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_soap.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_mysqli.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_mysqli.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_mysqli.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_pdo_mysql.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_pdo_mysql.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_pdo_mysql.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_fileinfo.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_fileinfo.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_fileinfo.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_intl.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_intl.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_intl.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: Failed loading Zend extension 'php_xdebug.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_xdebug.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_xdebug.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_curl.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_curl.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_curl.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_gettext.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_gettext.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_gettext.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_openssl.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_openssl.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_openssl.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_exif.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_exif.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_exif.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_gd.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_gd.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_gd.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_ftp.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_ftp.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_ftp.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_imap.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_imap.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_imap.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_bz2.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_bz2.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_bz2.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_mbstring.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_mbstring.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_mbstring.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_sodium.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_sodium.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_sodium.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_tidy.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_tidy.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_tidy.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_xsl.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_xsl.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_xsl.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_soap.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_soap.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_soap.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_mysqli.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_mysqli.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_mysqli.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_pdo_mysql.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_pdo_mysql.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_pdo_mysql.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_fileinfo.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_fileinfo.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_fileinfo.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_intl.dll' (tried: C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_intl.dll (The specified module could not be found), C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext\php_php_intl.dll.dll (The specified module could not be found)) in Unknown on line 0
PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in D:\Data\Documents\Websites\Local\rest1\app\public\wp-includes\class-wpdb.php:1810
Stack trace:
#0 D:\Data\Documents\Websites\Local\rest1\app\public\wp-includes\class-wpdb.php(734): wpdb->db_connect()
#1 D:\Data\Documents\Websites\Local\rest1\app\public\wp-includes\load.php(562): wpdb->__construct('root', 'root', 'local', 'localhost')
#2 D:\Data\Documents\Websites\Local\rest1\app\public\wp-settings.php(124): require_wp_db()
#3 phar://C:/Program Files (x86)/Local/resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1336): require('D:\\Data\\Documen...')
#4 phar://C:/Program Files (x86)/Local/resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1254): WP_CLI\Runner->load_wordpress()
#5 phar://C:/Program Files (x86)/Local/resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#6 phar://C:/Program Files (x86)/Local/resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/bootstrap.php(78): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState))
#7 phar://C:/Program Files (x86)/Local/resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap()
#8 phar://C:/Program Files (x86)/Local/resources/extraResources/bin/wp-cli/wp-cli.phar/php/boot-phar.php(11): include('phar://C:/Progr...')
#9 C:\Program Files (x86)\Local\resources\extraResources\bin\wp-cli\wp-cli.phar(4): include('phar://C:/Progr...')
#10 {main}
thrown in D:\Data\Documents\Websites\Local\rest1\app\public\wp-includes\class-wpdb.php on line 1810
This is from C:\Users\user_name\AppData\Roaming\Local\run\site_id\conf\php\php.ini :
[PHP]
engine = On
extension_dir="C:/Program Files (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/ext"
Note: In php.ini, the sendmail_path, mailhog is subject to the same issue: {{mail.mailhogPath}}
Other components might be as well, depending on your addons.
This is from C:\Users\user_name\AppData\Roaming\Local\run\site_id\conf\apache\site.conf :
FcgidWrapper "C:/Program\ Files\ (x86)/Local/resources/extraResources/lightning-services/php-8.1.9+7/bin/win64/php-cgi.exe" .php
Thankfully, in C:\Users\user_name\AppData\Roaming\Local\sites.json the PHP version is only x.y.z, without the +patchID. However, in that file (and others) we also have versioning for Apache, NGinx, and MySQL/MariaDB. I don’t think I’ve seen warnings from those components due to the situation described here. Does that mean Local does update for those components and not for PHP? Perhaps an inquiry should be made into ensuring that configs are updated for these as well.
I hope that helps someone as we continue to update this fine software, not wanting to get slowed down by unexpected new problems.