Using WP commands in site shell results in unexpected errors / warnings

Bug Summary

When calling WP CLI commands from iTerm2 ZSH I encounter multiple errors/warnings in console output before the command output is displayed.

Steps to reproduce

  1. Select Local site from list in left sidebar
  2. Click Overview tab
  3. Click Site shell
  4. Call any wp command
  5. See errors / warnings

Environment Info

Describe your environment.

  • What Operating System are you using?
    • macOS 15.5 (24F74)
  • What versions of site software (Nginx, Apache, PHP, MySQL) is used?
    • NGINX
    • PHP 8.2.27
    • MySQL 8.0.16
  • What version of Local is installed?
    • 9.2.5+6810

Supporting info

Note that I truncated the log file, then shut down Local, restarted, and restarted the site I’m working with to narrow the focus.
local-lightning.log (3.3 KB)

After starting the Site shell I immediately see the following output.

/Users/amatthews/Library/Application\ Support/Local/ssh-entry/bn1YaFZpt.sh; exit
-n -e
Setting Local environment variables...
----
WP-CLI:   WP-CLI 2.12.0
PHP version 8.2.27 (/Users/amatthews/Library/Application Support/Local/lightning-services/php-8.2.27+1/bin/darwin/bin/php)
Run the "diagnose" command to get more detailed diagnostics output.
Composer: 2.8.6 2025-02-25
PHP:      8.2.27
MySQL:    mysql  Ver 8.0.16 for macos10.14 on x86_64 (MySQL Community Server - GPL)
----
Launching shell: /bin/zsh ...

When executing any WP CLI command I see the following output before my command response is displayed.

$ wp post list --post_type=boardgame --posts_per_page=5
Failed loading /Users/amatthews/Library/Application Support/Local/lightning-services/php-8.2.27+1/bin/darwin/lib/php/extensions/no-debug-non-zts-20220829/opcache.so:  dlopen(/Users/amatthews/Library/Application Support/Local/lightning-services/php-8.2.27+1/bin/darwin/lib/php/extensions/no-debug-non-zts-20220829/opcache.so, 0x0009): symbol not found in flat namespace '_zend_cannot_pass_by_reference'
Failed loading /Users/amatthews/Library/Application Support/Local/lightning-services/php-8.2.27+1/bin/darwin/lib/php/extensions/no-debug-non-zts-20220829/xdebug.so:  dlopen(/Users/amatthews/Library/Application Support/Local/lightning-services/php-8.2.27+1/bin/darwin/lib/php/extensions/no-debug-non-zts-20220829/xdebug.so, 0x0009): Library not loaded: /usr/local/opt/zlib/lib/libz.1.dylib
  Referenced from: <A6093A57-61A0-39E2-8AFA-B4822D877D96> /Users/amatthews/Library/Application Support/Local/lightning-services/php-8.2.27+1/bin/darwin/lib/php/extensions/no-debug-non-zts-20220829/xdebug.so
  Reason: tried: '/usr/local/opt/zlib/lib/libz.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/zlib/lib/libz.1.dylib' (no such file), '/usr/local/opt/zlib/lib/libz.1.dylib' (no such file)

Warning: PHP Startup: imagick: Unable to initialize module
Module compiled with module API=20220829
PHP    compiled with module API=20190902
These options need to match
 in Unknown on line 0

I just noticed that xdebug support is on (even though I’ve never been able to get it working). I disabled that option and restarted the site. Upon opening Site shell I immediately see the following output:

Last login: Sat Jul 19 12:45:56 on ttys000
/Users/amatthews/Library/Application\ Support/Local/ssh-entry/bn1YaFZpt.sh; exit
☀  mm-herald  /Users/amatthews/Library/Application\ Support/Local/ssh-entry/bn1YaFZpt.sh; exit
-n -e
Setting Local environment variables...
----
WP-CLI:   WP-CLI 2.12.0
PHP version 8.2.27 (/Users/amatthews/Library/Application Support/Local/lightning-services/php-8.2.27+1/bin/darwin/bin/php)
Run the "diagnose" command to get more detailed diagnostics output.
Composer: 2.8.6 2025-02-25
PHP:      8.2.27
MySQL:    mysql  Ver 8.0.16 for macos10.14 on x86_64 (MySQL Community Server - GPL)
----
Launching shell: /bin/zsh ...

Then after running an WP CLI command I get the same output:

$ wp post list --post_type=boardgame --posts_per_page=5
Failed loading /Users/amatthews/Library/Application Support/Local/lightning-services/php-8.2.27+1/bin/darwin/lib/php/extensions/no-debug-non-zts-20220829/opcache.so:  dlopen(/Users/amatthews/Library/Application Support/Local/lightning-services/php-8.2.27+1/bin/darwin/lib/php/extensions/no-debug-non-zts-20220829/opcache.so, 0x0009): symbol not found in flat namespace '_zend_cannot_pass_by_reference'
Failed loading /Users/amatthews/Library/Application Support/Local/lightning-services/php-8.2.27+1/bin/darwin/lib/php/extensions/no-debug-non-zts-20220829/xdebug.so:  dlopen(/Users/amatthews/Library/Application Support/Local/lightning-services/php-8.2.27+1/bin/darwin/lib/php/extensions/no-debug-non-zts-20220829/xdebug.so, 0x0009): Library not loaded: /usr/local/opt/zlib/lib/libz.1.dylib
  Referenced from: <A6093A57-61A0-39E2-8AFA-B4822D877D96> /Users/amatthews/Library/Application Support/Local/lightning-services/php-8.2.27+1/bin/darwin/lib/php/extensions/no-debug-non-zts-20220829/xdebug.so
  Reason: tried: '/usr/local/opt/zlib/lib/libz.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/zlib/lib/libz.1.dylib' (no such file), '/usr/local/opt/zlib/lib/libz.1.dylib' (no such file)

Warning: PHP Startup: imagick: Unable to initialize module
Module compiled with module API=20220829
PHP    compiled with module API=20190902
These options need to match
 in Unknown on line 0

Hey @commadelimited!

Can you verify which version of the Local application you have installed?

Specifically, whether you are running the Intel or the Apple Silicon version?

If you go to the Application Folder and select Get Info you’ll see here:

Heya Nick, I have an Apple Silicon Mac, but it appears I’m using the Intel version of Local.


Looks like that might be the problem?

If I download and install the alternate version will I need to set my sites up again?

You should be able to download the Apple Silicon version from our releases page here: Releases - Local

And then replace you current application:

As always, it’s never a bad idea to back up your work first just in case something were to go awry. You could use our Cloud Backups addon, or the export feature to simply save zip copies of your site(s) to your desktop for example.

1 Like