Are there any downfalls to upgrading the server to PHP 8.0?

Artashes

Administrator
Staff member
What do I need to know before asking the provider to upgrade the PHP to 8.0 or even 8.3, from 7.4? Is there anything at all that may get affected that I am not thinking of right now?
 
Generally shouldn't be a problem, but Before upgrading PHP, check the compatibility of your website’s code, plugins, and libraries with PHP 8.x. Backup your site and database to prevent data loss and have a safe recovery point.
 
I actually wrote an article on upgrading to 8.3 earlier this month - https://www.bigredseo.com/upgrade-php-for-faster-wordpress/

There have been a few things depreciated, but it's mainly on calculations.

One BIG change that we noticed was on the String to Number Comparisons, the non-strict comparisons. We do a lot of this when it comes to custom code. Usually you're using "==" (non-strict) and "===" (strict). So you can think of "==" as a partial match.

In PHP 7.x this statement returned TRUE, but now they return FALSE.
Code:
0 == "foo"
0 == ""
42 =="42foo"

create_function() has been completely removed. No longer needed.
match is now a reserved keyword - so if you have created any functions, beware.

the default error_reporting level is now ALL - everything. Be sure you check your php.ini and redefine to exclude NOTICE and DEPRECIATD if you don't want to see those in your error logs. There's actually a bunch of changes that have happened with the error reporting where things that used to throw errors not just throw warnings or notices. So logging can be a little more detailed when needed.

mktime() will get a UNIX timestamp, however, you must now call with an at minimum the hour argument, and optionally call minute, month, day etc. So instead of mktime() you'll swap to using time().

So there's a few changes, but for most people, they're not going to notice much. Plugin developers etc need to be on the watch for the updates.

We've updated several WordPress sites without issues, but we have a few with custom code that had to be rewritten to handle the new functions.
 
Oh man, I am going to tell my developer to take a look at your article as well prior. I am struggling with speeding up WordPress, I've already purchased all the extra bells and whistles, but I find it is still exceptionally slow. Hopefully the PHP upgrade will add a bit of speed as well.
 
Oh man, I am going to tell my developer to take a look at your article as well prior. I am struggling with speeding up WordPress, I've already purchased all the extra bells and whistles, but I find it is still exceptionally slow. Hopefully the PHP upgrade will add a bit of speed as well.
I don't believe that upgrading your PHP version will lead to a significant improvement in speed. Instead, consider using a hosting that offers a LiteSpeed web server. The presence of plugins such as LiteSpeed Cache and the use of available presets can greatly enhance your website's load time. If you'd like, I can provide you with a test host. You can then load your backup on the test host, use the newer version of PHP along with the other recommendations I've mentioned, and compare the speed. If you see a performance improvement, you can implement these changes on your main host as well.
 
Depending on how you're using WordPress, sometimes the indexes on the posts table are woefully inadequate or outright missing. Also, mySQL/MariaDB has some cardinality in how the indexes are used, which is worth looking at too.

I notice this a lot with larger WooCommerce users, but I can see it translating over to just large websites with may posts.

Worth enabling the mySQL slow query log and investigating anything taking longer than a few seconds.
 
Oh man, I am going to tell my developer to take a look at your article as well prior. I am struggling with speeding up WordPress, I've already purchased all the extra bells and whistles, but I find it is still exceptionally slow. Hopefully the PHP upgrade will add a bit of speed as well.
From my experience moving to 8 doesn't move the needle much despite what is put out there about PHP 8 vs 7.

The thing is whatever comes that is more efficient, be it plugin code its probably going to need PHP 8.

If your site is relatively up to date 7.2+ you are going to have a few issues with magic quotes and stuff like that.

It's not major to fix, but do make a backup and get a dev to tweak things for you.

I don't know what you have done to speed up your site artashes I've also tried a lot of bells and whistles and for me, the best thing is to go into WordPress and strip as much as I can. You won't believe all the stuff that runs in the background when it's not needed from JS, CSS, Ajax requests, and even PHP functions call to the database.

It's very difficult to maintain though as when you update you need to repeat the process there are some plugins like Asset Manager that are doing an ok job at allowing you control over this. You can also use query monitor and load up pages to see whats happening on the PHP - SQL side.
 
It's very difficult to maintain though as when you update you need to repeat the process
This is probably one of the biggest headaches lots of people face. We rely heavily on Asset Manager and Query Monitor to remove sections from pages or posts or products etc.

One you nail down what you want to remove, you can use the 'wp_deregister" and "wp_dequeue" to remove sections and then kill off the Query Monitor plugin (we use the plugin to find and test, but manually run the reregister/dequeue in our own function/plugin).

This helps prevent duplication, but as always, any time there's an update, it's still something to review before just launching.

There's no "one time set it and forget it" when it comes to anything WordPress related :)
 
I don't believe that upgrading your PHP version will lead to a significant improvement in speed. Instead, consider using a hosting that offers a LiteSpeed web server. The presence of plugins such as LiteSpeed Cache and the use of available presets can greatly enhance your website's load time. If you'd like, I can provide you with a test host. You can then load your backup on the test host, use the newer version of PHP along with the other recommendations I've mentioned, and compare the speed. If you see a performance improvement, you can implement these changes on your main host as well.
That's incredibly kind, thank you. I know for sure that my host offers LiteSpeed, I am just not sure if I am running it on my server specifically. Thanks for pointing this out, I am going to ask.
 
Incompatibility issues: Applications that were developed on older versions of PHP may not work properly with PHP 8.0. This could cause compatibility issues and require the application to be rewritten or updated.
Performance issues: While PHP 8.0 has improved performance and speed, certain applications or scripts may not be optimized for the new version of the language. This could lead to performance issues and slower page load times.
 
Incompatibility issues: Applications that were developed on older versions of PHP may not work properly with PHP 8.0. This could cause compatibility issues and require the application to be rewritten or updated.
Performance issues: While PHP 8.0 has improved performance and speed, certain applications or scripts may not be optimized for the new version of the language. This could lead to performance issues and slower page load times.
This, right here.

LSWS and caching will help also, as others have mentioned. Since you mentioned you're getting into WP stuff, take a look at quic.cloud for those domains/subdomains because you'll find that integrates way better there.
 
Back
Top