Updating to PHP 8.2 when using WordPress and WP CLI
Introduction
I’ve had a little time lately to get ahead of the game and update, run and test several WordPress sites using PHP 8.2. The results have been mostly very good with the exception of WP CLI which I’ll cover later.
Composer
Works fine using version 2.5.5 and tested with various setups from simple to complex (calling in updates from multiple sources.)
WordPress
No issues with core using version 6.3.1 and following are a list of plugins that I know for sure are error free.
- Advanced Custom Fields PRO
- Advanced Custom Fields: Image Aspect Ratio Crop
- Cloudflare
- Code Profiler
- Contact Form 7
- Disable Genesis Schema
- EWWW Image Optimizer
- Fathom Analytics
- Genesis Connect for WooCommerce
- Limit log in attempts reloaded
- MailerSend – Official SMTP Integration
- ManageWP – Worker
- MC4WP: Mailchimp for WordPress
- Query Monitor
- ReCaptcha v2 for Contact Form 7
- Redirection
- SpinupWP
- WooCommerce
- WooCommerce Quantity Increment
- WooSidebars
- WP 2FA – Two-factor authentication for WordPress
- WP Featherlight
- WP Mail SMTP
- Yoast SEO
WP CLI
Updating using the update command
I had been running version 2.7.1 and using PHP 8.2 caused dozens of deprecated errors and ultimately failing. I tried running the update command;
wp cli update
It failed with the error message;Error: The downloaded PHAR is broken, try running wp cli update again.
Updating manually
In order to update to the latest version 2.8.1 (which works with a couple of deprecation notices) I had to do so manually by overwriting the original. Check out the documentation to install WP CLI in order to do so. It was a quick and painless process and after some research the only way I could find in order to get it running again.
Final thoughts
The update to PHP 8.2 was far easier than I thought it would be but the issues updating WP CLI came as a surprise. I’m certain the team behind this awesome software will sort the issue soon.
// End of Article
Article Information
Further Reading
- Installing WP CLI (wordpress.org)
- Updating WP CLI (wordpress.org)