Solved: Blank Issue Magento 2.2.7 and 2.3 Admin
Magento 2 CMS is an effective platform for the running of e-commerce companies and can be managed via the admin panel. Admin is responsible for the store’s functionalities and any errors in the admin panel are unacceptable. However, after updating or installing Magento 2.2.7 and Magento 2.3, the clients faced the question of the blank page in the admin panel!
We fixed this problem and have agreed to publish it as a workaround for all Magento 2.2.7 and Magento 2.3 store owners.
If you have downloaded or updated the new version recently and face the blank issue of the Magento 2.2.7 and 2.3 admin page, as shown below, follow the solution given in the article.
Solutions : Magento 2.2.7 and 2.3 Admin Page:
How to solve blank issue of Magento 2.2.7 admin page:
You’ll find this code:
protected function isPathInDirectories($path, $directories)
{
if (!is_array($directories)) {
$directories = (array)$directories;
}
foreach ($directories as $directory) {
if (0 === strpos($this->fileDriver->getRealPath($path), $directory)) {
return true;
}
}
return false;
}
Which shall be replaced by the following code
protected function isPathInDirectories($path, $directories)
{
$realPath = str_replace('\', '/', $this->fileDriver->getRealPath($path));
if (!is_array($directories)) {
$directories = (array)$directories;
}
foreach ($directories as $directory) {
if (0 === strpos($realPath, $directory)) {
return true;
}
}
return false;
}
:
How to solve the Magento 2.3 admin page blank issue:
Navigate to #/vendor/magento/framework/View/Element/Template/File/Validator.php:114
Find the below string:
1 | $realPath = $this->fileDriver->getRealPath($path); |
and replace it with:
1 | $realPath = str_replace(‘\\’, ‘/’, $this->fileDriver->getRealPath($path)); |