Problem with missing PHP extensions

I run a command line script that will download a production server to my local. It’s been working great for a long time. All of the sudden I’m getting errors like this:

Output: Failed loading /Users/mikemuller/Library/Application Support/Local/lightning-services/php-7.4.30+6/bin/darwin/lib/php/extensions/no-debug-non-zts-20190902/opcache.so:

Is there a reason those extensions are not loading or not present? How can they be re-installed easliy?

It’s hard to know for sure what’s going on without a little more detail.

From that path, it looks like you’re using an Intel Mac (the darwin part of the path) – can you give a little more detail around the OS version that’s running as well as the version of Local that’s being used?

Also, what kind of remote environment is the script pulling from? It’s possible that the remote server added something like an mu-plugin that tries to leverage some kind of opcache features and which weren’t present in earlier versions of the site.

You might also try a different version of PHP. PHP 7.4.x reached its EOL back in 2022: PHP: Supported Versions and we haven’t made any updates to it for a long time.

I’m actually an MI mac. I’m pulling from a Cloudways/Digital Ocean server. I was uninstalling some PHP that was installed with Homebrew a week ago and then this started happening. Should I completely uninstall Local and then reinstall it?

Forgot to mention that this is happening during the database import process. The error occurs when the dump.sql.gz file it tring to be imported into the local database.

Also getting this error with the xdebug extension:

Output: Failed loading /Users/mikemuller/Library/Application Support/Local/lightning-services/php-8.1.23+0/bin/darwin-arm64/lib/php/extensions/no-debug-non-zts-20210902/opcache.so: dlopen(/Users/mikemuller/Library/Application Support/Local/lightning-services/php-8.1.23+0/bin/darwin-arm64/lib/php/extensions/no-debug-non-zts-20210902/opcache.so, 0x0009): symbol not found in flat namespace ‘_pcre2_code_free_8’
Failed loading /Users/mikemuller/Library/Application Support/Local/lightning-services/php-8.1.23+0/bin/darwin-arm64/lib/php/extensions/no-debug-non-zts-20210902/xdebug.so: dlopen(/Users/mikemuller/Library/Application Support/Local/lightning-services/php-8.1.23+0/bin/darwin-arm64/lib/php/extensions/no-debug-non-zts-20210902/xdebug.so, 0x0009): symbol not found in flat namespace ‘__zend_get_parameters_array_ex’

So this is only happening when trying to import this specific site from Cloudways but not on any other sites?

How are you “pulling” the site? Using a migration plugin?

As a workaround, are you able to use any of our alternative import methods? Like importing a zip file or manually moving over the WP Content and SQL?

It seems to be only cloudways but is happening on multiple differeent servers from different cloud hosting platforms. This was working perfectly about 1 week or so ago and then stopped working and throwing that error. It’s been working with no error for at least a year. Just trying to figure out what changed. Nothing changed on the cloudways side of things. The error that is most concerning is the xbdebug one as that 's a native plugin for Local.

Hi @mikemuller

Have you tried downgrading to see if that resolves the issue since it seems to be with the recent release?

I did downgrade and that did not help. Could this be a problem with my local machine? I did uninstall some stuff that was installed via homebrew.

symbol not found in flat namespace ‘_pcre2_code_free_8’
Failed loading /Users/mikemuller/Library/Application Support/Local/lightning-services/php-8.1.23+0/bin/darwin-arm64/lib/php/extensions/no-debug-non-zts-20210902/xdebug.so: dlopen(/Users/mikemuller/Library/Application Support/Local/lightning-services/php-8.1.23+0/bin/darwin-arm64/lib/php/extensions/no-debug-non-zts-20210902/xdebug.so, 0x0009): symbol not found in flat namespace ‘__zend_get_parameters_array_ex’

This seems like an issue with the php extension?

Not sure if this helps but I found this document about the change:

Would updating the version of MySQL in Local fix this?

Sorry for the multiple threads but I get this when doing a standard wp export db command inside local on my machine:

Launching shell: /bin/zsh …
mikemuller@Mikes-MacBook-Pro-3 public % wp export db dump.sql
Failed loading /Users/mikemuller/Library/Application Support/Local/lightning-services/php-8.1.23+0/bin/darwin-arm64/lib/php/extensions/no-debug-non-zts-20210902/opcache.so: dlopen(/Users/mikemuller/Library/Application Support/Local/lightning-services/php-8.1.23+0/bin/darwin-arm64/lib/php/extensions/no-debug-non-zts-20210902/opcache.so, 0x0009): symbol not found in flat namespace ‘_pcre2_code_free_8’
Failed loading /Users/mikemuller/Library/Application Support/Local/lightning-services/php-8.1.23+0/bin/darwin-arm64/lib/php/extensions/no-debug-non-zts-20210902/xdebug.so: dlopen(/Users/mikemuller/Library/Application Support/Local/lightning-services/php-8.1.23+0/bin/darwin-arm64/lib/php/extensions/no-debug-non-zts-20210902/xdebug.so, 0x0009): symbol not found in flat namespace ‘__zend_get_parameters_array_ex’

Warning: Module “imagick” is already loaded in Unknown on line 0
Error: Too many positional arguments: db dump.sql
mikemuller@Mikes-MacBook-Pro-3 public % wp db export dump.sql
Failed loading /Users/mikemuller/Library/Application Support/Local/lightning-services/php-8.1.23+0/bin/darwin-arm64/lib/php/extensions/no-debug-non-zts-20210902/opcache.so: dlopen(/Users/mikemuller/Library/Application Support/Local/lightning-services/php-8.1.23+0/bin/darwin-arm64/lib/php/extensions/no-debug-non-zts-20210902/opcache.so, 0x0009): symbol not found in flat namespace ‘_pcre2_code_free_8’
Failed loading /Users/mikemuller/Library/Application Support/Local/lightning-services/php-8.1.23+0/bin/darwin-arm64/lib/php/extensions/no-debug-non-zts-20210902/xdebug.so: dlopen(/Users/mikemuller/Library/Application Support/Local/lightning-services/php-8.1.23+0/bin/darwin-arm64/lib/php/extensions/no-debug-non-zts-20210902/xdebug.so, 0x0009): symbol not found in flat namespace ‘__zend_get_parameters_array_ex’

Warning: Module “imagick” is already loaded in Unknown on line 0
Success: Exported to ‘dump.sql’.
mikemuller@Mikes-MacBook-Pro-3 public %

Any ideas?

How many sites do you have in @mikemuller? It might be worth trying a full uninstall/reinstall but you’d want to make sure all of your sites/work is backed up and saved.

Already did that as well. Deleted the app, Application Support files, etc.

I just tried the wp db export command using the same files (Imported from the exported zip file) on a different computer and it worked fine. It was an Intel computer though.

So the one with the problems is an Apple Silicon? I’m assuming you have Rosetta 2 installed? Otherwise, you probably wouldn’t be able to start sites at all but just want to check.

Yes, it is the Apple Silicon mac. I did run the lates software update around the same time. Could that be it? I do have Rosetta 2 installed.

Any thoughts on this?

Hi, @mikemuller.

I was uninstalling some PHP that was installed with Homebrew a week ago and then this started happening.

Are you confident that there is now no other version of PHP installed on your system? If your shell environment tries to load another version of PHP in addition to Local’s version, it could result in the errors about incompatible libraries that you see.

Some things you can try:

  1. Check that brew info php does not show “Installed”, like this:

    > brew info php
    ==> php: stable 8.3.7 (bottled), HEAD
    General-purpose scripting language
    https://www.php.net/
    Installed
    

    If it’s installed via brew, you can try uninstalling it (brew uninstall php). You may need to uninstall other packages that depend on PHP to do this (brew will tell you if so).

  2. Temporarily rename your shell config file (usually at ~/.zshrc), restart Local, and see if you still see issues. If that fixes things, you may have something in your shell config that’s loading another version of PHP. (Some apps write to your shell config, so it might not be something you’ve added manually.)

If those ideas don’t help, you can also try removing the versions of PHP that Local installed to force it to redownload them as described here.