Magento Extensions Fixing a Blank White Page in Magento 2

« Back to Magento Extensions

If you see either a blank white page in Magento 2 or you see some content on the page which suddenly stops, this usually means that a PHP fatal error has occured. A PHP fatal error is an error that PHP cannot recover from and forces PHP to stop what it's doing and exit.

Fixing a blank white page can be very difficult as there no clues as to what could be causing the error. To make this easier, we will tell PHP to reveal the error message by making a small change in our index.php file in Magento 2. To do this, access your Magento site using FTP (or SFTP/SSH) and edit your index.php file. Depending on how you have things setup, this may be in the root or in the pub folder. If you're are unsure, try editing both.

To enable errors, just add the following command to the index.php file.

ini_set('display_errors', 1);
error_reporting(E_ALL);

Add this at the top of the file but after the <?php line.

Refresh the error page in the browser and this should allow the error message to display.

If you cannot see the error message, try viewing the HTML source and scrolling right to the bottom and the error may be displayed there.