Skip to main content

PHP 7 End of Life Part 2


In the previous article, we talked about how PHP 7 has come to an end and it is crucial to update to PHP 8 as soon as possible. We outlined the steps you would need to take if you are on a WordPress project. In this article, we will dive into more details about how to update the PHP version of your Drupal website.


Drupal websites often come with custom modules and custom code for features and functionalities tailored to your website. These may become complexities when trying to update your website. Always make sure you have a backup of a working copy of your live website in case anything goes wrong so you don’t lose any content, data, or features.

Update core, modules, database

Make sure you have a fresh copy on your local environment so that if there will be any issues when it comes to deploying to the live site, you are more likely to have replicated on your local. Then, on your local environment, update Drupal core, contrib modules and the database, so they are compatible with PHP 8.

Update your local environment

The way to change it depends on what local server you are using to run your local environment, but you will have to change your local hosting server to PHP version 8.1 or above. For some solutions, you can configure it in a file, other solutions may be a dropdown you can choose from.

Update composer.json file

After updating the PHP version on your local server, you will need to make the change in your composer.json file. First, change the PHP version in the required section. Then, in the config section, change the PHP version. After that, run composer update --with-all-dependencies.

Check compatibility

There are modules, and commands you can utilize to check the compatibility of your code. This is meant for detecting outdated functions, syntax or any other deprecations of PHP 7.

Once you find the errors, fix them and check again.

Testing time

Once all the above steps are completed, it is time to test all areas of your website, test out the custom functions and features you may have and make sure they are all working as expected. If not, you might have to start digging for the reason why it isn’t working properly.

Ready to deploy

When everything on your local looks good and you have done your test thoroughly and found no additional bugs or issues, it is time to deploy. If the process to complete all the steps took a while, your backup might be outdated and new content might be added to the live site and it is time for a new backup before you go ahead and make the deployment. Once the backup is generated and good to go, you can now deploy your code to the live site and it should run PHP 8.1 smoothly.

Updating your Drupal website to PHP 8 is important, staying in PHP versions that have reached their end of life could introduce security risks and vulnerabilities. If you have any questions regarding upgrading your Drupal website, feel free to reach out to us our Drupal experts can definitely help you and make the process as painless as possible.

PHP Drupal 10 Security