In this guide, we describe the different options available to you to make your website compatible with the latest PHP version.
Our support is ready to help you to figure out what is wrong and guide you in the right direction. However, they cannot fix the script for you.
- Are you using a CMS like WordPress, Joomla or Drupal?
- Is your website made with custom code, that was specially written?
- Do you want to try to fix the code yourself?
Are you using a CMS like WordPress, Joomla or Drupal?
Then you can probably fix your site by updating it to the newest version. Some of your plugins, modules or extensions, may not be supported, but it's usually not a problem to find an alternative. Besides, if a plugin or extension doesn't support PHP 8.0, this is an indication that it hasn't been updated in a while, which might lead to other vulnerabilities.
Can you still revert to the previous PHP version?
Until 6 December 2021, PHP 7.3 is still available in the control panel, meaning you can go back to fix things. Reverting back to an older PHP version should cause your site to work again, allowing you to do updates from the back-end, which might be easier.
Please keep in mind that after 6 December, PHP 7.3 will be permanently removed from our servers and all websites are upgraded to the latest stable version. So going back to a previous version is only a means to help you fix the site, not a solution.
Is it no longer possible to go back to a previous PHP version?
Then you need to do a manual update. We have created a guide on how to do this for WordPress: Update WordPress manually.
For Drupal, please check the following external guides:
For Joomla, please check these links with guides and documentation:
Is your website made with custom code, that was specially written?
Then fixing it will be difficult; it requires the code to be rewritten to make it compatible with PHP 7.4.
Can you contact the person or company that created your site?
The person who wrote the code is usually best equipped to update it. So if you have the option to get this person to help you, that may be the easiest solution. Otherwise, another developer that is familiar with coding in PHP should also be able to rewrite this for you.
The disadvantage of this solution is that you may have to pay a fee, and you will probably encounter the same issue when PHP 7.4 reaches end-of-life on 22 November 2022.
Have you considered switching to Website Builder or WordPress?
If fixing your site turns out to be too costly or time-consuming, it may be easier to recreate it on a different platform, like Website Builder or WordPress.
Website Builder doesn't use PHP at all, meaning you never have to update it. It's developed entirely in-house, which ensures that it works very well on our servers and is easy to maintain. If you need a website to showcase your company or organisation with an option to contact you, then Website Builder should cover your basics.
If you want to have more dynamic content, then WordPress is a good option. WordPress is used in roughly a third of all websites. This ensures that it is constantly updated and has a lot of themes and plugins to choose from, to cover all your needs.
Tip: Try out our Managed WordPress solution, giving you the best of both worlds; all the flexibility you need, while we take care of the updates and security.
Do you want to try to fix the code yourself?
We will show an example of how to go about fixing the PHP code yourself. Please keep in mind that it will be a steep learning curve if this is the first time you are trying it.
Before you make any changes to your site, we recommend you to make a backup.
- If you haven't done so yet, please enable PHP error messages on your domain.
- Open the website that is not working in your browser, you should now see an error message.
- Read the error message to find out what is wrong. What we can learn from this message is there is an undefined function called "mysql_connect" in the file hello-testing.php on line 2.
- Find more information about the undefined function "mysql_connect". You can do a search on Google, or on php.net. Searching tells us that mysql_connect is a deprecated function that no longer works in PHP 7 and that there are 2 alternatives.
- Locate the file that is causing the error in File Manager, in this example "hello-testing.php" and read the code that is written.
- Rewrite the deprecated code, so that it is compatible with, at least, PHP 7.4. In this example, we are replacing the function "mysql_connect" with the newer function "mysqli_connect". We also add the name of the database, because mysqli requires this, and replace the other mysql_ functions.
- If we open the website now, the error message is gone and the site is visible again.
This was a very easy example to fix, in most situations you need to make multiple changes to the code to make it work again. For more information about deprecated and removed functions, please check the migrating documentation on php.net.
Related articles: