Im attempting to use the WP CLI when my local is on PHP 8. It mostly works until I attempt to use “wp db query” commands or anything of the sort where it actually needs to communicate with the db. I think somehow search-replace works though. I get errors like:
“ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)”
I also wrote some custom wp db commands that also dont work. My suspicion is that this is an incompatibility between my local WP CLI version and PHP 8.
I attempted to update the WP CLI, but it wont let me.
" The ‘cli update’ command has been disabled from the config file."
What config file? How can I change that so I can update it?
Hey @robruiz - long-time no see, hope you’re doing well!
Interesting - I tried this on a site of mine on PHP 8.0.22 (it’s possible you’re on PHP 8.0.0?) and this was my output of
wp db query - it appears to have worked.
If you have some examples of other commands I can try running, let me know. I’m also on Local v6.5.1.
That said, that’s not what you asked! How to disable that:
- The config lives in
- If you open the Applications directory and right click on Local, hit “Show Package Contents”
- Navigate to Contents/Resources/extraResources/bin/wp-cli and open that config
- Comment out the first couple of lines (it says disabled commands), save, and relaunch Local
To be honest, I thought we had removed that be default so users could do this - I’ll check on why that’s still there. But if you follow those steps, you’ll be able to run that update command again. Sorry for the hassle! We’ll also work on bumping to the updated version.
Update: it shouldn’t still be there, we thought we had gotten rid of that “disabled commands” portion. I’ve made a ticket for the engineering team that’ll take care of that, and
wp cli update should work in when we get that in a release!
Thanks for the diligence in looking into that. I will dig into this more this coming week.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.