Why does my website give a white screen (WSOD)?
Whenever you get a white screen, most of the times it has to do with a PHP error in the website code. To solve these issues it can help to see the error message in full, instead of a white error screen, white screen of death or WSOD.
Steps to enable display_errors on Shared servers
The first step in debugging is to find out which PHP error you’re getting. To check this out, you need to turn on a PHP setting in cPanel; display_errors.
Step 1: Log in to cPanel.
Step 2: Under Software, click Select PHP Version.
Step 3: Click Switch To PHP Options. If your PHP version is set to native this option is not usable. If this is the case, select a different PHP version and click Set as current.
Step 4: Tick the box next to display_errors.
Step 5: Visit the website.
Now you have enabled the display_errors option you can visit the site again, and you should see a PHP error. Based on this error you can decide if this is something you can figure out, or if you are going to restore a backup.
Also read: How do I restore a backup of my website with AutoBackup?
Steps if no errors are visible
If you don’t see any errors when turning on display_errors, something in your website might overrule the PHP setting of cPanel. You can try putting the following lines of code in your index.php between the <?php tags:
error_reporting(E_ALL);
ini_set(‘display_errors’, TRUE);
ini_set(‘display_startup_errors’, TRUE);
This overrules the PHP settings of your website and you should see the errors on your website.
Steps to enable log_errors on Shared servers
Sometimes it is not desirable to enable display_errors on your website. For example, if you do not want to show the PHP errors to your visitors. The log_errors option in cPanel is a good alternative, as the errors are stored in a log file rather than shown to the visitors.
Step 1: Log in on cPanel
Step 2: Under Software, click Select PHP version.
Step 3: Click Switch to PHP options. If your PHP version is set to native this option is not usable. If this is the case, select a different PHP version and click Set as current.
Step 4: Tick the box next to log_errors. This option is enabled by default.
Step 5: Go back to the main screen of cPanel.
Step 6: Under the Files category, click File Manager.
Step 7: Go to the document root of your domain. For the main domain of your package this is the public_html folder.
Step 8: Open the error_log file by right clicking and clicking Edit.
You will see the PHP errors in chronological order here.
Steps to enable display_errors on Cloud Servers
Step 1: Log in to the cPanel account of your customer.
Step 2: Click option MultiPHP INI Editor under the Software category.
Step 3: Select the domain where you want to enable the display_error option on.
Step 4: Enable display_errors.
Step 5: Click Apply.
Step 6: Go to the website.
Now you have enabled the display_errors option you can visit the site again, and you should see a PHP error.
Steps to enable log_errors on Cloud Servers
By default log_errors are enabled on Cloud servers too. If this is the case on your Cloud, you can skip steps 1 through 5. If the error_log is empty you could follow these steps to verify log_errors is enabled.
Important: With these settings you enable log_errors for your full Cloud, for the PHP version you select in step 3.
Step 1: Log in to WHM.
Step 2: Go to MultiPHP INI Editor under the Software category.
Step 3: Go to the Editor Mode and select the PHP version you want to change the log_errors setting on.
Step 4: Go to the line where log_errors = Off is shown and change this to log_errors = On. Use CTRL-F on Windows to search on a page, or Command-F on MacOS to search on a page. There are multiple lines containing log_errors, the line we are looking to change is shown in the example.
Step 5: Click Save.
Step 6: Go to the website, if there are PHP errors in the website, this should generate a error_log entry.
Step 7: Log in to the cPanel account of the customer.
Step 8: Click on File Manager under the Files category.
Step 9: Go to the document root of the domain. For the main domain of the package, this is the public_html folder.
Step 10: Open the error_log file by right clicking and clicking Edit.
You should see the PHP errors in chronological order.