White Screen of Death for unknown reason but fixes after rebooting the server

I don’t think this can provide a solution but hopefully I can help you troubleshoot a little.

Firstly, let’s go over debugging:

Debugging

You’re saying “white screen of death”, but the screenshot you provided looks more like it’s hanging while trying to load the page. Typically, the WSOD appears as exactly that – a completely blank page. Your screenshot shows the default “New Tab” view and a loading spinner, suggesting that the server is not responding.

If you leave this page “loading” for a bit of time (several minutes at least), do you get any kind of error? Usually, Chrome will eventually kick in with a message like “Too many redirects” or something similar when it finally gives up or does it actually finally fail with a white screen?

wp-admin and White Screen

If it is a white screen, what do you get when trying to go to /wp-admin/? This is important, because WordPress will surface some debugging-related information if there is a problem in your installation’s database setup when you access /wp-admin/ that would otherwise not appear on the front-end.

WordPress debug log

WordPress also includes internal debugging that is disabled by default. In your question, you note that you checked the error logs, but didn’t specify which ones. It could be helpful to do the following:

  • Add these lines to wp-config.php:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );

This will enable debug logging to the file /wp-content/debug.log. Try loading your site again and waiting until the load fails (server timeout, too many redirects, etc). Check the log to see if you find any errors

The SQL Error

While likely not the cause of your issues, the SQL error can be easily handled. Your custom query should have the LIMIT statement after the ORDER BY clause:

SELECT * FROM  view_site_numbers WHERE campaign_id = "7" AND `use` = "PPC"  ORDER BY number DESC LIMIT 2

Further investigation

As others have noted, it may be worth looking at stackoverflow.com for more help, as the issue definitely “feels” server-related. You said you recently upgraded your PHP version – it might not hurt to see if you can downgrade and see if the issue persists, however, I can’t think of anything off the top of my head that might cause an issue like this (if it is infinite loading and not a direct white screen).

Also, given that it only happens intermittently, makes me think it’s less to do with the application code than something going on with the server itself. If you have access to access logs you could check for DDOS attempts. You should also check your processes to see if anything is leaking and eating more and more memory without being properly stopped, or just running forever and eating away at your CPU.

Good luck!