WP-CLI Zend Xdebug Errors

Using 5.2.3 (on Mac) and went to do a few things with WP-CLI and the following errors came up.

Zend OPcache requires Zend Engine API version 320180731.
The Zend Engine API version 320190902 which is installed, is newer.
Contact Zend Technologies at http://www.zend.com/ for a later version of Zend OPcache.

Xdebug requires Zend Engine API version 320180731.
The Zend Engine API version 320190902 which is installed, is newer.
Contact Derick Rethans at https://xdebug.org/docs/faq#api for a later version of Xdebug.

Try updating. I just used wp cli within the container without issue.

I’m already on the latest 5.2.3.

Got the same error as I’m using PHP 7.4 on my Mac. You have to downgrade to PHP 7.3.x. I did it quickly with brew:

Get the current version PHP:

php-config --version

If it’s 7.4.x than first unlink php:

 brew unlink php

Install the latest version of 7.3

 brew install php@7.3

When the installation is finished run

php-config --version

which now should display 7.3.5

run wp cli info and the error should be gone.

1 Like

Hi Zaver,

Thanks for the info. I did have PHP 7.4 running. I however now get different errors after switching PHP 7.3.

wp cli info
Failed loading /Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-7.3.5+3/bin/darwin/lib/php/extensions/no-debug-non-zts-20180731/opcache.so:  dlopen(/Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-7.3.5+3/bin/darwin/lib/php/extensions/no-debug-non-zts-20180731/opcache.so, 0x0009): code signature in (/Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-7.3.5+3/bin/darwin/lib/php/extensions/no-debug-non-zts-20180731/opcache.so) not valid for use in process: mapping process is a platform binary, but mapped file is not
Failed loading /Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-7.3.5+3/bin/darwin/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so:  dlopen(/Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-7.3.5+3/bin/darwin/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so, 0x0009): code signature in (/Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-7.3.5+3/bin/darwin/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so) not valid for use in process: mapping process is a platform binary, but mapped file is not
PHP binary:	/usr/bin/php
PHP version:	7.3.11
php.ini used:	/Users/brycejacobson/Library/Application Support/Local/run/bt80Suo91/conf/php/php.ini
WP-CLI root dir:	phar://wp-cli.phar
WP-CLI vendor dir:	phar://wp-cli.phar/vendor
WP_CLI phar path:	/Users/brycejacobson/Local Sites/testsite/app/public
WP-CLI packages dir:
WP-CLI global config:	/Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/bin/config.yaml
WP-CLI project config:
WP-CLI version:	1.4.1

I’m not sure if this is because my PHP is now at 7.3.11 or something else. I might try re-installing Local at some point.

I’m having similar issues and am wondering why when Local first sets up the SSH instance, it reports a different PHP version than what I have installed locally? It should be using that one for WP-CLI commands instead of looking for my local config, right?

I don’t want to have to change my local PHP version just to use Local. Isn’t that what containers are for?

For reference, this is what I get when I first open a Local shell (I have PHP 7.4.2 installed locally):

Setting Local environment variables...
----
WP-CLI: WP-CLI 2.4.0
PHP:    7.3.5
MySQL:  mysql  Ver 8.0.16 for macos10.14 on x86_64 (MySQL Community Server - GPL)
----
Launching shell: /usr/local/bin/zsh ...
Zend OPcache requires Zend Engine API version 320180731.
The Zend Engine API version 320190902 which is installed, is newer.
Contact Zend Technologies at http://www.zend.com/ for a later version of Zend OPcache.

Xdebug requires Zend Engine API version 320180731.
The Zend Engine API version 320190902 which is installed, is newer.
Contact Derick Rethans at https://xdebug.org/docs/faq#api for a later version of Xdebug.

Can you run

brew reinstall php@7.3

and check if this helps. Otherwise you have to compile xdebug as explained here.

Hope that helps!

If you open your site in SSH Local sets up the “Local environment variables” for the current shell session.

If you run php -v there and in a new terminal window you most likely get different php versions. Local doesn’t change you php version globally but just for the current session.

Please correct me on that @clay

If Local is truly setting up environment variables, they aren’t sticking. The GUI shows my site running PHP 7.3.5, which matches what my terminal shows right after “Setting Local environment variables…”, but right after that it launches a new shell and that’s where the OPcache errors start.

Since Local seems to be using the PHP binary found at /Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-7.3.5+3/bin/darwin/bin/php, shouldn’t the shell use that same version? I shouldn’t have to have a different version installed globally on my machine just for the CLI to work, right?

I just modified the shell script that runs for the site environment to use /bin/sh instead of my current shell (/usr/local/bin/zsh with Oh My Zsh) and it works just as expected.

Not sure where, but there’s definitely a conflict with the script trying to run my existing shell.

In Local 5.4.2, the shell script that executes sets the path so that Local’s version of PHP, MySQL, and WP-CLI take precedence over my locally-installed versions, which is absolutely fantastic.

No more path hacks in my shell, no more conflicts with my regular versions, and no more Xdebug problems. Thanks!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.