1

When I save new category, I proceed to exception page.

exception 'Magento\Framework\Exception\LocalizedException' with message 'Can't create directory /var/www/html/var/generation/Magento/Catalog/Model/Indexer/Category/Product/.' in /var/www/html/vendor/magento/framework/Code/Generator.php:103 Stack trace:

/var/www/html/vendor/magento/framework/Code/Generator/Autoloader.php(35): Magento\Framework\Code\Generator->generateClass('Magento\Catalog...')

1 [internal function]: Magento\Framework\Code\Generator\Autoloader->load('Magento\Catalog...')

2 [internal function]: spl_autoload_call('Magento\Catalog...') 3 /var/www/html/vendor/magento/framework/Code/Reader/ClassReader.php(19): ReflectionClass->__construct('Magento\Catalog...') 4 /var/www/html/vendor/magento/framework/ObjectManager/Definition/Runtime.php(44): Magento\Framework\Code\Reader\ClassReader->getConstructor('Magento\Catalog...')

5 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(71): Magento\Framework\ObjectManager\Definition\Runtime->getParameters('Magento\Catalog...')

6 /var/www/html/vendor/magento/framework/ObjectManager/ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Catalog...', Array) 7

/var/www/html/vendor/magento/framework/Indexer/ActionFactory.php(35): Magento\Framework\ObjectManager\ObjectManager->create('Magento\Catalog...', Array) and more...#0

What is the problem? And how can I resolve it? I use Magento ver. 2.0.0

2
  • try sudo chmod -R 755 var pub and check once Sep 13, 2016 at 10:04
  • 1
    I solved this problem with your advice. Thank you so much.
    – Naoto
    Sep 13, 2016 at 10:10

2 Answers 2

0

Your var folder does not have the right permissions.

I suggest you follow the official documentation to set the right permissions on your Magento instance: http://devdocs.magento.com/guides/v2.0/install-gde/prereq/file-system-perms.html

cd <your Magento install dir>
find var vendor pub/static pub/media app/etc -type f -exec chmod u+w {} \;
find var vendor pub/static pub/media app/etc -type d -exec chmod u+w {} \;
chmod u+x bin/magento
1
  • I appreciate your advice.
    – Naoto
    Sep 13, 2016 at 10:11
0

Double-check your permissions. I believe this is a common issue for new setups. From root, run the below to amend permissions:

sudo chmod -R 777 var pub

Then clear your cache:

sudo rm -rf var/cache/* var/generation/*

Ref: http://devdocs.magento.com/guides/v2.0/install-gde/prereq/file-sys-perms-over.html

2
  • 1
    I don't think the documentation recommends 777 Sep 13, 2016 at 9:57
  • I appreciate your quick reply. I solved this problem. Thank you so much.
    – Naoto
    Sep 13, 2016 at 10:00

Your Answer

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

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