Hello vineet_singh1,
Magento 2 CMS is a suitable platform for running an E-commerce business and can be administered using an admin panel. The admin is liable for the functionalities of the store. However, many users are facing the issue of a blank page in the admin panel after the upgrade or installation of Magento.
If you have recently upgraded or installed the latest version and encountered the Magento admin page blank issue, you must follow the steps below to fix the issue,
- Firstly, navigate to the following path:
/vendor/magento/framework/View/Element/Template/File/Validator.php:113
- Now, locate the below 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;
}
- Then, replace it with the below 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;
}
If the issue persists, you can follow the ways mentioned below,
- Firstly, navigate to below file path,
#/vendor/magento/framework/View/Element/Template/File/Validator.php:114
- Then, locate the below string:
$realPath = $this->fileDriver->getRealPath($path);
- Next, replace it with the following code,
$realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path));
- Lastly, save the file and refresh Magento 2 admin page.
PHP memory limit:
You will have to check the server settings and increase the memory limit in files php.ini, .htaccess, or index.php.
- If you can edit server configurations, open the php.ini and set a memory limit of 756M with the following command:
ini_set('memory_limit', '756M');
- Finally, flush the Magento cache using the below command to apply changes,
php bin/magento cache:flush
I hope the ways above help you to solve the Magento "Blank page at login admin" issue.
------------------------------
Regards,
Rex M
AccuWeb Hosting | Magento Hosting