So you’re thinking of migrating from PHP 7.4 to PHP 8. But if you’re a seasoned coding pro you’ll know that when it comes to scripts and code, making big changes can be risky. So before you do anything, there’s a few things you need to keep in mind if you want to minimise that risk. That’s why we’re here with our checklist of tips and best practices for migrating to PHP 8. Let’s get started!

Should you migrate to PHP 8?

The short answer? Most likely. One of the biggest reasons is that community support for 7.4 is ending in November 2022. This means that, while you can still use it, you’ll be reliant on third-party support. PHP 8 also has improved performance over older versions, and brings bags of benefits with it.

But as with anything like this, whether or not you should migrate to PHP 8 is down to your own project needs – if you were making use of features that are deprecated in 8.0 or 8.1 then you might not want to move.

Benefits of moving to PHP 8

Each new release of PHP boasts new features, security patches and performance improvements, and PHP 8 is no different. The one thing to consider is which version of PHP 8 you’d go for because they each have their own set of perks. Here’s a snippet of what they each offer:

Features of PHP 8.0

  • Just-In-Time (JIT) compiler
  • Attributes
  • Names Arguments
  • Match expressions
  • Developer-friendly improvements

Features of PHP 8.1

  • Enums
  • New array functions
  • The ‘never’ type
  • Readonly properties

And that’s just for starters!

Curious to know what else PHP 8.0 and 8.1 have to offer? We’ve got a whole blog about the benefits of moving to PHP 8.

Tips for migrating to PHP 8

If you know code, you know things can break easily, sometimes all you have to do is look at it. So when you’re migrating PHP versions, you can imagine that there’s a lot that could go wrong if you don’t plan, prepare and research before you do anything. It might sound like a lot of hassle, but in reality a few steps can make a huge difference to how long your migration takes and how successful it is. Here’s our checklist of tips and best practices for moving to PHP 8 – you can thank us later.

Before you migrate

When moving your house, you spend time beforehand planning and getting stuff ready before you even load a box into the van, right? It’s the same with migrating to a different PHP version. Here’s an array of things you’ll want to make sure you do (see what we did there…):

Nail your timing

Plan, plan, and plan some more. You want to plan the migration for a time that won’t have a big impact on your project. For example, if you have sites reliant on PHP, you’re not going to want to be messing around with updates when your site is at its busiest. Aim for a quieter time, but also make sure either you're free or someone else is on hand in case something does go wrong.

Do some testing

If you're making changes yourself, or relying on an upstream application to do the heavy-lifting of migrating to PHP 8 for you, you’ll want to test your application. Focus on common and heavily-used functions first – but also don’t leave those rarely used scripts behind either (think about things that perhaps only run at a certain time of the year or are done occasionally). The trick with testing is to run your script on a representative platform, with real data (if possible) – making your tests as true-to-live as you can will give you a better idea if things will run correctly.

Back everything up

Now you know when you want to migrate to a newer PHP version, you need to make sure you back everything up. If the newer version of PHP 8 clashes with your scripts and breaks something, you’re going to want a copy of your files that you can restore – we’re sure you don’t want to end up sitting there unpicking your scripts.

Update your software

Before you migrate to PHP 8, you need to make sure your software is up to date, like your CMS (WordPress, Joomla etc.). That’s because if, for example, you’re using an older release of WordPress that doesn’t support PHP 8, and you decide to switch to PHP 8… well, let’s just say things could go bang (figuratively of course!).

What we’re trying to say is that you’ll want to update anything that uses your PHP scripts to make sure that they can support the release you’re making the move to. If your software can’t support your PHP, then some stuff just won’t work.

Backward incompatible changes

We talked about some features that have been added in PHP 8.0 and PHP 8.1, but new releases don’t just have new features added to them, they also have older features removed and even some changed. So for instance, if you’re migrating from PHP 7.4 to 8.0, there are new reserved keywords, each() has been removed and the ability to use array_key_exists() has been removed and that barely touches the surface.

Thankfully PHP makes dev life a little easier by releasing an outline of backward incompatible features and deprecations when migrating from both 7.4 to 8.0 and 8.0 to 8.1.

After you migrate

You’ve done your checks, you’ve backed up your files and finally migrated to PHP 8 (mini celebration), now you need to make sure it all went to plan.

Checking scripts still work

We mentioned backward incompatible features and deprecations and you may think you’ve got that covered, but no matter how confident you are that you looked over everything, you should still check your scripts. We don’t need to tell you that if you’ve missed something and your code isn’t working, it’s not good. It could be something small, but if it isn’t you’ll thankfully have that backup we told you to create in case you need to revert back.

Checking site content still displays properly

Even if your code is working and is error-free, it’s a good idea to cast an eye over your web pages and make sure your site content is displaying as it should. If you find that there’s content missing, then something has gone wrong – an error message should explain what’s caused the issue.

Test everything (again)

Now you’ve checked your scripts in the backend and you’ve seen how it looks on the frontend, it might feel like you’re home safe. But – and it’s a big but – it’s still good practice to test everything again. Make sure your links are working, any functionalities are working as they should and check your plugins and site navigation. A good way of doing it is to use your site as you expect a visitor to, by clicking CTAs, scrolling and interacting with features.

How do you migrate to PHP 8?

If the techie stuff is a bit out of your comfort zone, don’t worry just yet. Migrating your PHP version doesn’t have to be complicated and thankfully, a lot of hosting providers have their own help guides to take you through it step by step – like us! And even if you’re a coding pro, you probably have a lot on your plate, without having to spend ages figuring out how to update your PHP.

If you’re a Fasthosts customer, you can find several guides in our knowledgebase that cover how to change your PHP version for your Web Hosting, WordPress Go, Plus and Advance packages as well as other WordPress Hosting packages.


If you need any extra help migrating to PHP 8, we have a whole Partner Network full of pros that can lend a helping hand.And don’t forget that we have our own team of experts here to help you 24/7 with your Fasthosts products. From your WordPress Hosting to your Dedicated Servers, we’re here to answer your questions.