0

After upgrading the Magento 2, the following error is showing in browser:

exception 'RuntimeException' with message 'Can't create directory /home/saudifishcorner/public_html/var/generation/Magento/Framework/App/Response/Http/.' in /home/saudifishcorner/public_html/vendor/magento/framework/Code/Generator.php:115 Stack trace: 0 /home/saudifishcorner/public_html/vendor/magento/framework/Code/Generator/Autoloader.php(35): Magento\Framework\Code\Generator->generateClass('Magento\Framewo...') 1 [internal function]: Magento\Framework\Code\Generator\Autoloader->load('Magento\Framewo...') 2 [internal function]: spl_autoload_call('Magento\Framewo...') 3 /home/saudifishcorner/public_html/vendor/magento/framework/Code/Reader/ClassReader.php(19): ReflectionClass->__construct('Magento\Framewo...') 4 /home/saudifishcorner/public_html/vendor/magento/framework/ObjectManager/Definition/Runtime.php(44): Magento\Framework\Code\Reader\ClassReader->getConstructor('Magento\Framewo...') 5 /home/saudifishcorner/public_html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(71): Magento\Framework\ObjectManager\Definition\Runtime->getParameters('Magento\Framewo...') 6 /home/saudifishcorner/public_html/vendor/magento/framework/ObjectManager/ObjectManager.php(71): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Framewo...') 7 /home/saudifishcorner/public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(126): Magento\Framework\ObjectManager\ObjectManager->get('Magento\Framewo...') 8 /home/saudifishcorner/public_html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(53): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\Framewo...', NULL, 'response', 'Magento\Framewo...') 9 /home/saudifishcorner/public_html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(82): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\Framewo...', Array, Array) 10 /home/saudifishcorner/public_html/vendor/magento/framework/ObjectManager/ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Framewo...', Array) 11 /home/saudifishcorner/public_html/vendor/magento/framework/App/Bootstrap.php(233): Magento\Framework\ObjectManager\ObjectManager->create('Magento\Framewo...', Array) 12 /home/saudifishcorner/public_html/index.php(38): Magento\Framework\App\Bootstrap->createApplication('Magento\Framewo...') 13 {main}

3

Remove var/generation , var/cache ,var/page_cache folder from your magento2 root directory and then run below commands in sequence.

  • sudo chmod -R 777 var

  • php bin/magento deploy:mode:set developer (set the mode of environment is developer)

  • php bin/magento setup:di:compile(it will generate all the proxies and dependencies )
  • php bin/magento setup:static-content:delpoy(it will deploy all the static content)
  • php bin/magento cache:clean and php bin/magento cache:flush(clear the cache)

Note : Make sure your var and pub/static folder have writable permissions

0

You have to assign permission to var folder, 777 like we are changing in local with chmod -R 777 var

then this will work perfect, hope this will help,

0

run command:

sudo chmod -R 777 var/

and

sudo chmod -R 777 pub/

under magento2 root directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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