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.
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.
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?
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