Hello Blog,
On New Year’s I decided to write my new year’s wish, and when I came to visit my site it gave me the white screen of death (WSOD). (For the blessedly uninitiated, the white screen of death refers to the empty browser window filled with white instead of your WordPress installation). My reaction was along the line of: “Seriously! Exactly two years ago my site was down like this. I am through with [REDACTED hosting company name]”. New Year’s day is a difficult day for me, being the anniversary of my dad’s death. But, unlike two years ago I felt that I could do my own technical support. I settled in to fix my blog. Step zero was making a complete backup of the server.
My first port of call was to start a technical support chat with the hosting company’s technical support. (Based on issues I have had along the way with them I was not entirely unconvinced that they had messed up. Spoiler: they hadn’t) So, the helpful guy on the other end of the chat had a quick look and came back with the verdict that it looked like WordFence was causing issues on my site.
It is definitely prudent to run a Web Application Firewall (WAF) on any WordPress site at the moment, but I admit my frustration that my site’s downtime was caused by the very thing that is meant to protect it. I have neither reached out to WordFence, nor looked through their documentation, in order to see whether I was just particularly unlucky or there is a known issue that was causing the particular crash.
Once I established that WordFence was the issue I went into my cPanel (you can just as easily do it through an FTP client) and began renaming the plugin folder. This gave me some progress, instead of getting a WSOD I instead got the error message:
Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0 Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0 Fatal error: Unknown: Failed opening required '*/wordfence-waf.php' (include_path='.:/opt/cpanel/ea-php70/root/usr/share/pear') in Unknown on line 0
This meant that I had something to Google which led me to find that WordFence adds some php to the user.ini file, and that I needed to delete:
php_value auto_prepend_file '/home/public_html/wordfence-waf.php'
from it. Thank you to wfasa for her reply on a ticket in the WordPress.org support thread which allowed me to figure this out.
That should have taken care of the initial error, but when I tried to access my site again (even after clearing my browser’s cache) I got that same error. Between myself and the support agent, we figured that W3TC might be presenting the cached error messages instead of the site. And so, next step in this mission was to disable W3TC without having access to the /wp-admin dashboard.
This was where things got slightly more technical. Firstly, because I needed access to the .htaccess file I needed to change my control panel’s settings to view hidden files. My Google-fu took me to a helpful post by Journal Xtra on how to remove W3TC manually. I was battling to get his fix to work with my wp-config.php permission set to 755 so I decreased the permissions to 644 (I don’t have sufficient server side knowledge to know if this was a bizarre quirk, something related to the cPanel issues I was having due to my Firefox preferences of opening links in a new tab (eventually I was doing the technical things in Chrome), or something unrelated that got tweaked along the way). After permissions were set to 644 and I had deleted:
- w3-total-cache-config.php
- db.php
- advanced-cache.php
I edited my .htaccess to remove the blocks of code inserted by both WordFence and W3TC. This was made easy and stress free by the fact that I had done a complete backup of the files on the server before I started tinkering and that the code inserted into the .htaccess by both plugins was clearly commented out.
Finally, when I refreshed my site and was greeted by my WordPress installation. I then eventually, hours after I had planned to was able to write my post).
[Sidenote: When I rename files or folders like this I literally append _renamed to the folder or file because it changes the path and makes it super easy to find what you have changed. When you are doing this type of thing you really should keep track of what you are changing for two reasons, one so you can replicate the fix in the future and two so you can undo the fix in the present if you mess something up. ]
Love and fixing my own stuff,
Trisha