WordPress: A critical error occurred on the site – impossible to enter the control panel (SOLVED)
February 21, 2020
After updating the plugins in WordPress on my VPS server, the site stopped opening. And it was even impossible to open the control panel – a message was displayed during all attempts (you can see a screenshot in the header of this article):
A critical error occurred on the site. Please check the incoming admin mail for further instructions.
Learn more about debugging in WordPress.
That is, it is impossible to fix the error through the control panel – it is impossible to get there, not change the settings, and not roll back the changes.
I didn’t receive the mentioned email – because it’s an experimental VPS and the mail service is not configured there.
In general, it is impossible to open the control panel, I did not receive a letter in the mailbox, and even if I received it, what can I do if the control panel is not available?!
It would seem a stalemate. The WordPress forums recommend “look for where you have the PHP error log on your hosting (you can ask for technical support of the hosting if you yourself can’t find it), see what's there at the end of the file, critical errors are marked as Fatal”.
I opened the error log for this site:
tail -n 50 /var/log/httpd/site.ru-error_log
But it turned out to be completely empty (maybe for this host I did not configure something).
By the way, Apache error logs on Debian, Linux Mint, Ubuntu, Kali Linux and their derivatives are placed in the /var/log/apache2/* files. And the Apache logs on Arch Linux and derivatives are placed in the /var/log/httpd/* files. This is the default – in fact, the logs can be anywhere in the file system, check the settings for a specific virtual host.
What to do if you cannot log in to your WordPress dashboard
So, the strategy is as follows:
- since the problem arose after the update, I need to find the ability to roll back updates
- I do not have access to the WordPress admin area, so I have to roll back changes at the file system level
- I don’t remember which plugin or theme was updated, as a result the site stopped working. Therefore, to find out which plugins have been updated, I will look at the timestamps, when folders and files were changed.
So, by default (this can be changed by the settings of the web server and individual virtual hosts), website files in Debian, Linux Mint, Ubuntu and their derivatives are stored in the /var/www/html/ directory. And with Arch Linux, site files are stored along the/srv/http/ path.
So, I go to the folder with the site:
The plugin files are located in the wp-content/plugins/ folder, I run the ls command (shows the contents of the folder) with the options -l (list the files with file information) and -t (sort files in the list by time of change):
ls -lt wp-content/plugins/
And here is what I see:
Today, February 18th, only one folder was changed, it is sitetree. The solution is very simple – remove the sitetree plugin.
How to remove WordPress plugin without access to control panel
You can install and remove WordPress plugins simply by unpacking their contents into the wp-content/plugins folder or by removing files of a plugin in this folder. That is, I run the rm command:
rm -rf wp-content/plugins/sitetree/
It is dangerous to use the rm command on a working (production) server, so here is a description of the arguments:
-f means ignore non-existent files and arguments, don't ask anything. Delete non empty folders -r, -R, --recursive means recursively delete directories and their contents
And… the problem is solved – the website is working, the entrance to the WordPress admin panel is open. The only change is that the sitetree plugin is no longer installed. But this does not matter, this plugin, after a long period of lack of updates, already had one unsuccessful update, as a result of which the links from the “All Articles”/“Site Tree” sections disappeared and on my more popular sites I already found an alternative to this plugin. That is, I do not need to figure out what exactly this plugin did not like in my server with PHP 7.4.
WordPress does not work after updating the theme
By the way, if the problem is caused by updating the theme, then you can view the last changed themes like this:
ls -lt wp-content/themes/
If the problem is caused by updating the theme, then you can delete the folder even with the current active theme, in this case, the site will stop working with something like this error:
The catalog of the theme "........" does not exist.
But this is not a very big problem – entering the WordPress dashboard will still be available and you can select and install a new theme in the Appearance → Themes settings.
Errors caused by updating website or web server components are rarely so serious that you need to remove everything and install/configure it again. Even if the site “doesn’t work at all”, just find the reason and fix it.
By the way, for Linux users, what I described, that is, the ls and rm commands are the most elementary things. But for Windows users, perhaps, even after reading, nothing is clear. It’s not even clear where to enter these commands. Therefore, I recommend that webmasters switch to Linux, this will help to better understand this operating system.
UPD: email ‘Technical problems occurred on the site’
I managed to get the email that was mentioned in the first error (I updated the same plugin on another site ):
Starting with version 5.2, WordPress can detect errors with plugins or a theme on the site and send you similar messages automatically.
This time WordPress found an error with one of the plugins - SiteTree.
First go to your website (https:/site.ru/) and check all the visible problems. Next, go to the page on which the error occurred (https://site.ru/wp-admin/) and check the visible problems on it.
Please contact hosting technical support to further diagnose this problem.
Most importantly, this post indicates the plugin that caused the problem. If you have access to the admin panel, then delete it.
But, as I described my situation, it may be that there is no access to the admin panel, and therefore the second part is especially interesting:
If your site is broken and you can’t log into the console normally, you can now use the special “recovery mode”, which will allow you to safely log into the console for further actions.
For security reasons, this link expires in 1 day. But do not worry, if the error occurs again after this time, a new link will be sent to you.
To solve the problem, you need the following information:
WordPress Version 5.3.2
Current theme: Asteroid (version 1.2.8)
Problem plugin: SiteTree (version 2.1)
PHP Version 7.2.23
That is, with the help of the sent link there is even a chance to go into a broken WordPress.
- How to disable dash replacement in WordPress. AutoCorrect settings for characters and words in WordPress (82%)
- Multi-button mouse for increased productivity (63.9%)
- Cashback on airline tickets and hotels (50%)
- How to find out Wi-Fi password nearby (50%)
- How to use Kali Linux to check web-sites (24.3%)
- All the ‘tips of the day’ LibreOffice (RANDOM - 7.8%)