6

I have successfully created a new module in app/code/CompanyName_ModuleName and created etc/module.xml and after that run following command from my terminal in my sudo php bin/magento setup:upgrade my module is showing in config.xml file and it's value is set 1. But as soon as I hit the Url in browser I found this error/exception

exception 'Magento\Framework\Exception\LocalizedException' with message 'Can't create directory /var/www/html/hml/var/generation/Magento/Framework/App/Response/Http/.' in /var/www/html/hml/vendor/magento/framework/Code/Generator.php:103 Stack trace: #0 /var/www/html/hml/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 /var/www/html/hml/vendor/magento/framework/Code/Reader/ClassReader.php(19): ReflectionClass->__construct('Magento\Framewo...') #4 /var/www/html/hml/vendor/magento/framework/ObjectManager/Definition/Runtime.php(44): Magento\Framework\Code\Reader\ClassReader->getConstructor('Magento\Framewo...') #5 /var/www/html/hml/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(71): Magento\Framework\ObjectManager\Definition\Runtime->getParameters('Magento\Framewo...') #6 /var/www/html/hml/vendor/magento/framework/ObjectManager/ObjectManager.php(71): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Framewo...') #7 /var/www/html/hml/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(236): Magento\Framework\ObjectManager\ObjectManager->get('Magento\Framewo...') #8 /var/www/html/hml/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(53): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\Framewo...', NULL, 'response', 'Magento\Framewo...') #9 /var/www/html/hml/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(82): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\Framewo...', Array, Array) #10 /var/www/html/hml/vendor/magento/framework/ObjectManager/ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Framewo...', Array) #11 /var/www/html/hml/vendor/magento/framework/App/Bootstrap.php(233): Magento\Framework\ObjectManager\ObjectManager->create('Magento\Framewo...', Array) #12 /var/www/html/hml/index.php(38): Magento\Framework\App\Bootstrap->createApplication('Magento\Framewo...') #13 {main}'

Please help me out...Thanks in advance.

1

3 Answers 3

5

Giving full permission (775) to var and pub directory after upgrade.

Run the command using .

  1. chmod -R 775 var pub
  2. run php bin/magento setup:di:compile command
  3. php bin/magento setup:upgrade
  4. clear cache.
1

Give permission (775) to var/ and pub/static folders, so upgrade again.

You can use this commands below.

chmod -R 775 pub/static/ var/
php -f bin/magento setup:upgrade
php -f bin/magento cache:flush
0

Permissions issue, ensure your web server user is the owner of website directories. After

sudo php bin/magento setup:upgrade

Issue following command:

sudo chown -R user:group .

from root directory of the website. You can find user and group by issuing ls -l command.

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.