I updated the PHP version on the hosting and the website crashed, what should I do?
Please assist me, I made the mistake of updating the PHP version through the hosting without taking necessary precautions. I changed the PHP version first and then saved a backup copy using the UpdraftPlus - Backup/Restore plugin. As a result, I can no longer access the WP admin panel and the website is not visible anywhere. When I visit the domain, I see the message "A critical error has occurred on the site."
Initially, the PHP version was 5.6, but I tried updating it to the latest version 7.4, then downgraded it to versions 7 and 5.6. A whole day has passed, but the website still doesn't function.
Additionally, I noticed the appearance of the php_errors log file in the hosting file manager.
Firstly, don't panic. The PHP upgrade could be incompatible with the current code of your WordPress plugins or theme causing the "A critical error" message. This can often be resolved, and you have a backup, which is great! Here's what you should do:
Check php_errors log file*: This file is probably full of error messages that will help to pinpoint the problem. Look for anything related to a plugin or theme. It may give you an exact line of code that's failing.
Disable plugins manually via FTP or File Manager: Since you can't access the WP admin, you'll need to use FTP or the host's File Manager. Navigate to the wp-content directory of your WordPress installation and you'll find the plugins directory. Rename this folder to something like 'plugins_old'. This will deactivate all your plugins. Check if the website is accessible after this. If it is, the issue is likely caused by one of the plugins. To find the offending plugin, revert the plugins_old folder to its original name, and then rename each plugin's folder one by one, checking your site each time until you find the one causing the issue.
Disable theme manually via FTP or File Manager: If the disabling of plugins didn't help, the problem might be with your theme. To disable your current theme, go to the 'themes' directory inside the wp-content directory. Rename your current theme's directory. WordPress will automatically revert to a default one if available. If it's the issue, you should be able to access your site now.
Restoring a backup: If you made a backup using UpdraftPlus, you can restore using that. The issue here would be that you can't access the WP admin panel to restore. However, UpdraftPlus backups can be manually restored. You need to access the database and files via your hosting panel or FTP. Instructions on how to this can be found in the official UpdraftPlus dоcumentation.
Contact your Hosting Provider: If all else fails, contact your hosting provider. They should be able to help, especially if it's related to the server configuration.
When you have access again, you should consider updating your plugins, theme, and WordPress before moving to a newer PHP version. Always ensure all plugins and themes are compatible with the version of PHP you're planning to move to to prevent this from happening again.
Here's a bit more detail on the steps mentioned above:
Check php_errors log file*: Look for any lines that reference a specific plugin or theme along with a fatal error message. This can guide you to which piece of your website is causing the conflict with the new PHP version. The errors will likely have a structure that mentions the file location, the line of the error, and specifics about the error itself.
Disable plugins manually via FTP or File Manager: If you can't access the WP admin, you can still disable plugins manually by altering their respective folders. Here's how:
Use an FTP client to connect to your server or use the file management tool provided by your hosting.
Navigate to the wp-content folder in your website's main directory.
Inside the wp-content folder, you will find the plugins folder. Rename it to something like plugins_old. By renaming the folder, you're in essence deactivating all of your plugins.
Go back to your website and see if it's accessible. If so, one or more of your plugins was causing the issue.
To determine which plugin is the culprit, change the name of the plugins_old folder back to plugins. Then, one by one, rename each individual plugin's folder and check your website after each one. When your website becomes inaccessible again, the last plugin you renamed is the one causing the problem.
Disable theme manually via FTP or File Manager: If deactivating the plugins didn't bring your site back, your theme might be the culprit:
Using an FTP client or the hosting file manager, navigate to wp-content/themes.
Locate the folder of your current theme and rename it. This forces WordPress to use a default theme (provided you have one installed, such as Twenty Twenty-One).
Check your site again. If you can now access your site, the problem lies with your theme.
Restoring a backup: To manually restore an UpdraftPlus backup, you'll need to:
Download the UpdraftPlus backup files from wherever you've stored them (hopefully off-site, like Google Drive, Dropbox, or another destination).
Upload the plugins, themes, uploads (for media files), and others files back to the wp-content directory.
The database backup (.sql file) can be restored via phpMyAdmin or similar database management tool. You'll need to create a new database, import the .sql file to that new database, and then update your wp-config.php file to make WordPress connect to this new database.
Contact your Hosting Provider: If all else fails, it's time to reach out to your hosting provider's support team. They have more direct access to server logs and might have solutions that you can't apply without direct server access.
Even more specificity on the various steps to troubleshoot your issue:
Check PHP error logs: The error log should be in the root of your website or sometimes it's under the 'logs' folder. Look for recent timestamps, and the word 'Fatal error'. You can use an online service to read your PHP error logs if you're not familiar with how to read them. This can give you more information about the error and what's causing it.
Disable plugins manually via FTP or File Manager: The process essentially involves renaming the plugins folder in your WordPress installation to something like 'plugins.deactivated'. You can do this directly from your hosting panel's file manager or using an FTP client like FileZilla.
Find the 'wp-content' directory, inside it you'll find the 'plugins' directory.
Right-click 'plugins' and select 'Rename'. Change the name to 'plugins.deactivated'
Now, try to access your WP admin or your website. If it works, then one of your plugins was causing the issue.
To find out which one:
Change the folder name back to 'plugins'.
Inside the 'plugins' folder, rename each plugin folder one by one and try to access your site each time. Whenever your site goes down, you know the last plugin you renamed is causing the issue. You can reinstall that plugin once everything else is working again.
Disable theme manually via FTP or File Manager: The process is similar to disabling plugins.
Find the 'wp-content/themes' directory, inside it, locate the directory of the theme you are currently using.
Rename the folder of your current theme to something like 'theme.deactivated'.
This will force WordPress to fall back to its default theme, and if your site works after this, you know it was the theme causing the issue.
Restore From Backup: If you backed up your site with UpdraftPlus, you would have separate files for each section of the website, such as the plugins, themes, database, etc.
To restore manually:
Download the backups of your site from wherever you've saved them.
Navigate to the wp-content folder via your File Manager or FTP.
Then, upload the plugins, themes, and uploads (for media files) files back into the directory.
For the database, you'd need to use a tool like phpMyAdmin which is typically accessible through the cPanel of your hosting account. This can be a bit tricky, so you might want to reach out to your hosting provider for help.
Ask your Hosting Provider for Help: Your hosting provider's support may be able to identify and fix this issue, especially if it's due to server misconfigurations or other issues on their end. Ideally, you should have access to 24/7 support and they will be able to guide you through the troubleshooting process.
Remember, always perform changes on a staging platform before applying them to a live website to avoid downtime of your live website. The staging platform should be an exact replica of your live website and is a safe environment for testing purposes. If a plugin or theme doesn't work with the new PHP version there, it won't work on your live website either.
It is functioning - do not modify it.
Alternatively, modify it, but on the testing site.
1. Revert the version back to 5.6;
2. Retrieve the files from either the hoster's or your backup;
3. Ultimately, eliminate the error message. Troubleshooting without it is akin to pointing a finger towards the sky.
The compatibility between versions 5.* and 7.* is abysmal.
If the WordPress software has not been updated for a significant period of time, it is advisable to upgrade it to the latest version. However, even after updating, there is no guarantee that installing PHP will go smoothly, as potential issues need to be identified and resolved beforehand.
It is important to question the purpose of installing PHP in the first place, apart from its perceived benefits of being "cool and fast." In the case of an older blog, prior to updating PHP, a considerable amount of work is required to update the entire system, including transferring any necessary patches or fixes, to ensure compatibility with the new version.
PHP 5.6 is ancient, and WP plus plugins/themes often break on PHP 7+. Start by checking the php_errors.log—it's your best clue. Rename the /plugins/ folder to disable all plugins and see if the site loads.
If it does, reactivate plugins one by one to identify the culprit. Next, switch to a default WP theme by renaming your active theme folder. Enable debugging by adding define('WP_DEBUG', true); to wp-config.php for detailed error messages.