WP-CLI Plugin List Error with PHP 8.1.29

What issue or error are you experiencing?

Hello,

I’m experiencing an issue with WP-CLI on my Local setup. When running wp plugin list:

Parse error: syntax error, unexpected token “?” in phar:///Applications/Local.app/Contents/Resources/extraResources/bin/wp-cli/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1335) : eval()'d code on line 2


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

My current setup:

  • Local version: [insert version of Local you’re using]
  • PHP version: 8.1.29
  • WP-CLI version: 2.11.0

I’ve attempted the following troubleshooting steps without success:

  • Tried reinstalling WP-CLI globally
  • Tested different PHP versions (8.1.29 and Local’s PHP)
  • Cleared WP-CLI cache and re-downloaded wp-cli.phar

Could you assist in resolving this issue? It seems related to PHP and WP-CLI compatibility within Local.


System Details

  • Version 9.1.0+6719

  • MACOS - 13.7.1 (22H221)


Local Logs

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


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.

Hi @Mac72

It might be a compatibility issue with the site and the version of PHP. Was this a site you pulled or imported from elsewhere? Does the PHP version in Local match what it was using?

Yes it does and this is a brand new site that I’ve built from scratch. Also here is some more info:

WP-CLI: WP-CLI 2.11.0
Composer: 2.6.2 2023-09-03
PHP: 8.3.11
MySQL: mysql Ver 8.0.16 for macos10.14 on x86_64 (MySQL Community Server - GPL)

Instead of wp plugin list can you run wp plugin deactivate --all? It might be if you have custom code in a plugin or theme that could be contributing the issue.

You could still try lowering the PHP version of the site as well. Maybe something isn’t compatible with PHP 8.3.11 so you could try 8.2, 8.1, etc.

I’ve tried lowering the PHP version and I’ve also triemd wp plugin deactivate -all to no avail. I think it’s related to WP-CLI - Local which I tried running globally.

If you create a new, blank site and add a plugin does the same behavior persist over there? If it does then you may need to try a full uninstall and reinstall of Local making sure to export and save your site and any work you have in the app first.

We have OS specific uninstall instructions here as you may need to manually remove certain configuration items. Uninstall Local - Local

Thanks Nick. I have a plugin which can handle the site export I’ll give it a go and create a fresh site.

1 Like

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