All of a sudden I'm getting a white screen when trying to login into my site. I had a look at my apache error log and found the following. Is anybody able to give me a clue on what the problem is and how to solve it?

PHP Fatal error: Uncaught exception 'Magento\Framework\Exception\LocalizedException' with message 'Can't create directory /var/www/html/magento/var/generation/Magento/Framework/App/ResourceConnection/.' in /var/www/html/magento/vendor/magento/framework/Code/Generator.php:103\nStack trace:\n#0 /var/www/html/magento/vendor/magento/framework/Code/Generator/Autoloader.php(35): Magento\Framework\Code\Generator->generateClass('Magento\Framewo...')\n#1 [internal function]: Magento\Framework\Code\Generator\Autoloader->load('Magento\Framewo...')\n#2 [internal function]: spl_autoload_call('Magento\Framewo...')\n#3 /var/www/html/magento/vendor/magento/framework/Code/Reader/ClassReader.php(19): ReflectionClass->__construct('Magento\Framewo...')\n#4 /var/www/html/magento/vendor/magento/framework/ObjectManager/Definition/Runtime.php(44): Magento\Framework\Code\Reader\ClassReader->getConstructor('Magento\Framewo...')\n#5 /var/www/html/magento/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(71): Magento\Framework\ObjectManager\ in /var/www/html/magento/vendor/magento/framework/Code/Generator.php on line 103

  • Check owner/permission of /var/www/html/magento/var. Commented Feb 25, 2016 at 1:55
  • drwxrwx--- 12 magento www-data Commented Feb 25, 2016 at 1:57
  • Just for testing make it 777. Also rename the "generation" folder (eg mv generation generation.bk Commented Feb 25, 2016 at 2:00
  • Thanks for your help and pointing me in the right direction.. Commented Feb 25, 2016 at 2:07

1 Answer 1


Re owning the /var/www/html/magento/var directory fixed this problem.

See here:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.