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}

Khoa Truong
32.5k11 gold badges91 silver badges159 bronze badges
asked Mar 21, 2017 at 12:12
1
  • Did you set the permission? Commented Mar 21, 2017 at 12:15

3 Answers 3

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

answered Mar 21, 2017 at 12:17
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,

answered Mar 21, 2017 at 12:22
0

run command:

sudo chmod -R 777 var/

and

sudo chmod -R 777 pub/

under magento2 root directory.

7ochem
7,61516 gold badges54 silver badges82 bronze badges
answered Mar 21, 2017 at 12:21

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.