cancel
Showing results for 
Search instead for 
Did you mean: 

Permissions error in 2.3

Permissions error in 2.3

Hi

I recently installed an extension to Magento 2.3 and since the compiling of the project I now get an error which seems to be permsissions based when I try and click into the Content > Design > Configuraton > Store edit

 

This is what it says:

1 exception(s): Exception #0 (RuntimeException): Can't create directory /home/level4productsco/public_html/generated/code/Magento/Theme/Model/Design/Backend/Exceptions/. Class Magento\Theme\Model\Design\Backend\Exceptions\Interceptor generation error: The requested class did not generate properly, because the 'generated' directory permission is read-only. If --- after running the 'bin/magento setup:di:compile' CLI command when the 'generated' directory permission is set to write --- the requested class did not generate properly, then you must add the generated class object to the signature of the related construct method, only.

 

The thing is, my Magento 2.3 installation is in a user account on a VPS, so I am not 100% what user permissions need changing as any new folder I create in the file manager lets me change permissions, but all Magento folders will not let me do anything. Any suggestions?

7 REPLIES 7

Re: Permissions error in 2.3

You need to following this things.

1. Remove "Generated" folder and clear the "Var" folder.

2. Run the upgrade and deploy commands and then check.

Was my answer helpful? You can Click Kudos/Accept As Solution.
200+ professional extensions for M1 & M2 with free lifetime updates!

Re: Permissions error in 2.3

This error is come due to cache.

 

You need to do following this things.

1. Go To "Var" folder & Remove "cache","page cache " folder .

 

Then Run Following commands:

 

php bin/magento setup:upgrade
php bin/magento di:compile
php bin/magento indexer:reindex
php bin/magento setup:static-content:deploy -f

 

Re: Permissions error in 2.3

Okay, i have the same problem, and unable to login in admin panel.

 

So maybe you could explain how to run following commands? Smiley Happy Make it simple, because I don't understand there I should write whose commands... 1000 times beter if you make simple youtube video, thank you!

Re: Permissions error in 2.3

he assumes you have ssh access on your host, i have no idea how do you run commands on shared hosting if you are using a vps the you need to go to:

/var/www/html/magentofoldershouldbehere and then type in that commands one by one along with giving proper file permissions at the end either you can run it as a shell script ie ./permissions.sh and let the file do everything ... you can run them manually one by one

#!/bin/bash
cd /var/www/html/magento2
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
find ./var -type d -exec chmod 777 {} \;
find ./pub/media -type d -exec chmod 777 {} \;
find ./pub/static -type d -exec chmod 777 {} \;
chmod 777 ./app/etc
chmod 644 ./app/etc/*.xml
chown -R www-data:www-data /var/www/html/magento2
chmod u+x bin/magento
echo given write permissions to bin/magento DONE!


OR you can use a 1 line command wich will take a lot of time but will complete the job aswell

cd /var/www/html/magento2 && find . -type f -exec chmod 644 {} \; && find . -type d -exec chmod 755 {} \; && find ./var -type d -exec chmod 777 {} \; && find ./pub/media -type d -exec chmod 777 {} \; && find ./pub/static -type d -exec chmod 777 {} \; && chmod 777 ./app/etc && ghmod 644 ./app/etc/*.xml && chown -R www-data:www-data /var/www/html/magento2 && chmod u+x bin/magento

after the tips givven regarding deleting cache you just run the script or this one line command fire up the webbrowser ... your site should be there

Re: Permissions error in 2.3

Thank you ELExTrO, i have been struggling with this for more than 6 months, your solution works like a charm !!!!

 

 

Re: Permissions error in 2.3

Also got this error in Magento 2.3.2 everything worked di:compile PHP 7.2

 

Now I moved fro Magento 2.4.6 using PHP 8.2

 

Class vendor\module\Model\Template\Filter\Interceptor generation error: The requested class did not generate properly, because the 'generated' directory permission  
   is read-only. If --- after running the 'bin/magento setup:di:compile' CLI command when the 'generated' directory permission is set to write --- the requested class  
  did not generate properly, then you must add the generated class object to the signature of the related construct method, only. 

 

Very strange permssion works and everything could be breaking old modules particularly Pelago/emorgifier is causing issue

 

                            @param \Pelago\Emogrifier $emogrifier
    \Pelago\Emogrifier $emogrifier,
   $emogrifier,     
 
I removed the module and it run but my store breaks and those dependent from it Smiley Sad

Re: Permissions error in 2.3

Hi @stillearningm2 

 

Did you manage to solve this as I'm also facing the same issue.