WP Cli error messages on local

What issue or error are you experiencing?

If I try and run a wp cli command from a Local instance I get the following error

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

Error: /opt/homebrew/Cellar/wp-cli/2.10.0/bin/wp is not writable by current user.

What steps can be taken to replicate the issue? Feel free to include screenshots, videos, etc

Any wp command causes this message

System Details

  • Local Version:

  • Operating System (OS) and OS version:

Local Logs

Attach your Local Logs here (Help Doc - Retrieving Local’s Log)

Uploaded here local-lightning

Security Reminder
Local does a pretty good job of scrubbing private info from the logs and the errors it produces, however there’s always the possibility that something private can come through. Because these are public forums, always review the screenshots you are sharing to make sure there isn’t private info like passwords being displayed.

Thanks for the report, @coreyallen. I can’t reproduce this on macOS so far (I tried Intel and Apple Silicon).

From the /opt/homebrew/Cellar/wp-cli/2.10.0/bin/wp path, it looks like the command is being invoked using a wp installed globally via homebrew.

If you’re not already, opening a shell via Local’s “open site shell” should set paths in a way that overrides your global wp to use the version that ships with Local (which should ensure PHP extensions are loaded correctly).

If that doesn’t help, you could try temporarily uninstalling your global wp (brew uninstall wp-cli) and opening the site shell again, which should ensure Local’s wp is used.

Thanks for replying @nickc . So I uninstalled wp-cli, opened shell via local and now when I try and run a wp command I get zsh: command not found: wp. Strange thing is the shel message does say has wp-cli Zight 2024-03-27 at 3.58.15 PM

Thanks for the info and screenshot, @coreyallen.

when I try and run a wp command I get zsh: command not found: wp.

Did you try restarting Local and your terminal application after removing the global version of WP-CLI?

If that doesn’t work, you could try opening Local’s site shell and typing echo $PATH. You should see the string, “/Applications/Local.app/Contents/Resources/extraResources/bin/composer/posix” somewhere in the path, which Local needs to find wp when it’s not installed globally.

If you don’t see that string, it’s possible that a custom zsh config or something else on your system is modifying the PATH in an unexpected way.

Hey @nickc yep I restarted local and the terminal. if I type echo $PATH I get the following Zight 2024-03-28 at 9.57.11 AM
Clearly this is the cause

Any guesses why opening terminal from local would look at the system’s path and not the local instance?

Agreed, it looks like something’s overriding Local’s additions to your PATH.

I’d start by checking your zsh config (normally at ~/.zshrc).

As a workaround you could edit your config to add Local’s path to wp (/Applications/Local.app/Contents/Resources/extraResources/bin/composer/posix), but it would be better to remove anything overriding the PATH if possible.

Really appreciate your patience with this @nickc
so I added it to my .zshrc file Zight 2024-03-28 at 10.58.2... rebooted my machine, but when I do echo $PATH from local terminal again that new line isn’t in there

You probably want to prepend the new path to the existing one, rather than overwriting the PATH (note the :$PATH at the end, missing in your version:

export PATH="/Applications/Local.app/Contents/Resources/extraResources/bin/composer/posix:$PATH"

But I would instead recommend commenting out all lines in your .zshrc file by prefixing them with # (or temporarily renaming the file so it’s no longer read by zsh), then closing and opening your terminal. If wp in a Local site shell then works, you know the issue is something in that file, and could comment out individual lines until you find the one.

@coreyallen It might well be this line that’s breaking things for you. It looks badly formed to me.

export PATH="$HOME/node_modules/:SPATH"export PATH=/opt/homebrew/bin:/Users/coreyhorob/ node_modules/:~/node_modules/:/Users/coreyhorob/-node/bin:/Users/coreyhorob/•nom=packages/bin:/ opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:, usr/sbin:/sbin:/var/run/com.apple.security.sryptex/codex.system/bootstrap/usr/local/bin:/var/

You could try removing that (as well as the new Local.app/… line you added, which shouldn’t be needed once your PATH is fixed).

@nickc commenting out all lines did the trick… Thanks so much for the help