1
[2018-01-12 11:58:16] main.CRITICAL: Can't create directory /home/hortbrascom/public_html/generated/code/Magento/Framework/App/Http/. in [Magento\Framework\App\Http\Interceptor] {"exception":"[object] (RuntimeException(code: 0): Can't create directory /home/hortbrascom/public_html/generated/code/Magento/Framework/App/Http/. in [Magento\\Framework\\App\\Http\\Interceptor] at /home/hortbrascom/public_html/vendor/magento/framework/Code/Generator.php:115)"} []

Im using Magento 2.2.2 | CentOS 7.4 | WHM 68.0.23

I know its an know issue about permissions, but i gave right permissions yesterday, and today the error returned.

Now i got this:

{"0":"Class Magento\\Authorization\\Model\\Acl\\Role\\GroupFactory does not exist","1":"#0 \/home\/site\/public_html\/vendor\/magento\/framework\/ObjectManager\/Definition\/Runtime.php(44): Magento\\Framework\\Code\\Reader\\ClassReader->getConstructor('Magento\\\\Authori...')\n#1 \/home\/site\/public_html\/vendor\/magento\/framework\/ObjectManager\/Factory\/Dynamic\/Developer.php(48): Magento\\Framework\\ObjectManager\\Definition\\Runtime->getParameters('Magento\\\\Authori...')\n#2 \/home\/site\/public_html\/vendor\/magento\/framework\/ObjectManager\/ObjectManager.php(70): Magento\\Framework\\ObjectManager\\Factory\\Dynamic\\Developer->create('Magento\\\\Authori...')\n#3 \/home\/site\/public_html\/vendor\/magento\/framework\/ObjectManager\/Factory\/AbstractFactory.php(144): Magento\\Framework\\ObjectManager\\ObjectManager->get('Magento\\\\Authori...')\n#4 \/home\/site\/public_html\/vendor\/magento\/framework\/ObjectManager\/Factory\/AbstractFactory.php(230): Magento\\Framework\\ObjectManager\\Factory\\AbstractFactory->resolveArgument(Array, 'Magento\\\\Framewo...', NULL, 'roleLoader', 'Magento\\\\Framewo...')\n#5 \/home\/site\/public_html\/vendor\/magento\/framework\/ObjectManager\/Factory\/Dynamic\/Developer.php(34): Magento\\Framework\\ObjectManager\\Factory\\AbstractFactory->resolveArgumentsInRuntime('Magento\\\\Framewo...', Array, Array)\n#6 \/home\/site\/public_html\/vendor\/magento\/framework\/ObjectManager\/Factory\/Dynamic\/Developer.php(59): Magento\\Framework\\ObjectManager\\Factory\\Dynamic\\Developer->_resolveArguments('Magento\\\\Framewo...', Array, Array)\n#7 \/home\/site\/public_html\/vendor\/magento\/framework\/ObjectManager\/ObjectManager.php(70): Magento\\Framework\\ObjectManager\\Factory\\Dynamic\\Developer->create('Magento\\\\Framewo...')\n#8 \/home\/site\/public_html\/generated\/code\/Magento\/Framework\/Acl\/Builder\/Proxy.php(84): Magento\\Framework\\ObjectManager\\ObjectManager->get('Magento\\\\Framewo...')\n#9 \/home\/site\/public_html\/generated\/code\/Magento\/Framework\/Acl\/Builder\/Proxy.php(95): Magento\\Framework\\Acl\\Builder\\Proxy->_getSubject()\n#10 \/home\/site\/public_html\/vendor\/magento\/module-backend\/Model\/Auth\/Session.php(227): Magento\\Framework\\Acl\\Builder\\Proxy->getAcl()\n#11 \/home\/site\/public_html\/generated\/code\/Magento\/Backend\/Model\/Auth\/Session\/Interceptor.php(102): Magento\\Backend\\Model\\Auth\\Session->processLogin()\n#12 \/home\/site\/public_html\/vendor\/magento\/module-backend\/Model\/Auth.php(159): Magento\\Backend\\Model\\Auth\\Session\\Interceptor->processLogin()\n#13 \/home\/site\/public_html\/vendor\/magento\/framework\/Interception\/Interceptor.php(58): Magento\\Backend\\Model\\Auth->login('admin', 'admin123')\n#14 \/home\/site\/public_html\/vendor\/magento\/framework\/Interception\/Interceptor.php(138): Magento\\Backend\\Model\\Auth\\Interceptor->___callParent('login', Array)\n#15 \/home\/site\/public_html\/vendor\/magento\/framework\/Interception\/Interceptor.php(153): Magento\\Backend\\Model\\Auth\\Interceptor->Magento\\Framework\\Interception\\{closure}('admin', 'admin123')\n#16 \/home\/site\/public_html\/generated\/code\/Magento\/Backend\/Model\/Auth\/Interceptor.php(78): Magento\\Backend\\Model\\Auth\\Interceptor->___callPlugins('login', Array, Array)\n#17 \/home\/site\/public_html\/vendor\/magento\/module-backend\/App\/Action\/Plugin\/Authentication.php(205): Magento\\Backend\\Model\\Auth\\Interceptor->login('admin', 'admin123')\n#18 \/home\/site\/public_html\/vendor\/magento\/module-backend\/App\/Action\/Plugin\/Authentication.php(157): Magento\\Backend\\App\\Action\\Plugin\\Authentication->_performLogin(Object(Magento\\Framework\\App\\Request\\Http))\n#19 \/home\/site\/public_html\/vendor\/magento\/module-backend\/App\/Action\/Plugin\/Authentication.php(125): Magento\\Backend\\App\\Action\\Plugin\\Authentication->_processNotLoggedInUser(Object(Magento\\Framework\\App\\Request\\Http))\n#20 \/home\/site\/public_html\/vendor\/magento\/framework\/Interception\/Interceptor.php(135): Magento\\Backend\\App\\Action\\Plugin\\Authentication->aroundDispatch(Object(Magento\\Backend\\Controller\\Adminhtml\\Index\\Index\\Interceptor), Object(Closure), Object(Magento\\Framework\\App\\Request\\Http))\n#21 \/home\/site\/public_html\/vendor\/magento\/framework\/Interception\/Interceptor.php(153): Magento\\Backend\\Controller\\Adminhtml\\Index\\Index\\Interceptor->Magento\\Framework\\Interception\\{closure}(Object(Magento\\Framework\\App\\Request\\Http))\n#22 \/home\/site\/public_html\/generated\/code\/Magento\/Backend\/Controller\/Adminhtml\/Index\/Index\/Interceptor.php(39): Magento\\Backend\\Controller\\Adminhtml\\Index\\Index\\Interceptor->___callPlugins('dispatch', Array, NULL)\n#23 \/home\/site\/public_html\/vendor\/magento\/framework\/App\/FrontController.php(55): Magento\\Backend\\Controller\\Adminhtml\\Index\\Index\\Interceptor->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#24 \/home\/site\/public_html\/vendor\/magento\/framework\/Interception\/Interceptor.php(58): Magento\\Framework\\App\\FrontController->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#25 \/home\/site\/public_html\/vendor\/magento\/framework\/Interception\/Interceptor.php(138): Magento\\Framework\\App\\FrontController\\Interceptor->___callParent('dispatch', Array)\n#26 \/home\/site\/public_html\/vendor\/magento\/framework\/Interception\/Interceptor.php(153): Magento\\Framework\\App\\FrontController\\Interceptor->Magento\\Framework\\Interception\\{closure}(Object(Magento\\Framework\\App\\Request\\Http))\n#27 \/home\/site\/public_html\/generated\/code\/Magento\/Framework\/App\/FrontController\/Interceptor.php(26): Magento\\Framework\\App\\FrontController\\Interceptor->___callPlugins('dispatch', Array, Array)\n#28 \/home\/site\/public_html\/vendor\/magento\/framework\/App\/Http.php(135): Magento\\Framework\\App\\FrontController\\Interceptor->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#29 \/home\/site\/public_html\/generated\/code\/Magento\/Framework\/App\/Http\/Interceptor.php(24): Magento\\Framework\\App\\Http->launch()\n#30 \/home\/site\/public_html\/vendor\/magento\/framework\/App\/Bootstrap.php(256): Magento\\Framework\\App\\Http\\Interceptor->launch()\n#31 \/home\/site\/public_html\/index.php(48): Magento\\Framework\\App\\Bootstrap->run(Object(Magento\\Framework\\App\\Http\\Interceptor))\n#32 {main}","url":"\/admin\/admin\/index\/index\/key\/a1049503f810d2386018104cb6e8418c7b239c7958782fb8fcb611da24b01b53\/","script_name":"\/index.php"}
  • did u setted cron? – Rizwan Khan Jan 12 '18 at 13:46
  • Yes i did. I deleted generated and the folder keeps popping up even deleting it and its files ... – Kauan Jan 15 '18 at 17:24
3

main.CRITICAL: Can't create directory

This is a permission problem, Magento is unable to write to your generated directory.

Please check this documentation to setup your permissions properly.

If you have SSH details then run following command from your magento root directory

sudo chmod -R 777 pub/media pub/static var generated

Magento\Authorization\Model\Acl\Role\GroupFactory does not exist

try following solution

  1. root> php bin/magento setup:static-content:deploy -f

  2. root> sudo rm -rf var/cache/* var/page_cache/* var/view_preprocessed/* var/generation/* pub/static/*

  3. Give write permisson for pub/media pub/static var generated

sudo chmod -R 777 pub/media pub/static var generated

  • By magento documentation 777 inst recommend, but if i set 755 doens't work... you know why? – Kauan Jan 15 '18 at 17:25
  • 755 means you can access and read the files only you can not write files in any folder with this permission and magento 2 generates files in these folders (pub/media, pub/static, var, generated) during loading page or execution of any command (upgrade, deploy, etc....) so you have to set 777. – Chander Shekhar Jan 16 '18 at 10:32
0

If you have created cron using

crontab -e 

Then remove cron from their and add cron using below command

crontab -e -u www-data
  • Second command doens't work, i'm using cpanel. – Kauan Jan 15 '18 at 17:26
  • Yes i did. I deleted generated and the folder keeps popping up even deleting it and our files ... – Kauan Jan 15 '18 at 17:27

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.