Hi everyone, i'm new here and im experiencing a lot of issues with permissions. I just today switched magento over to production mode and was faced with some permission issues. Since then ive been trying to fix them thru google searching and trying to follow others instructions, which I think at this point has got me a bit lost.
I've tried to follow the magento devdocs but they seem to only recognize a version of magento that uses "app/code" a folder which my version does not have. From the information i could gather, i think im facing a permission and user role/group issue, I'm able to still work but I had to set the var pub and generated folders to 777 which i know is a big no-no.
Oh and I'm using CentOS for this as well.
Thanks for the help!
Hello @aarondesig0cea
For ideal Magento site, permission need to set as below for the security and performance reason.
Please set this type of permission.
If you get the solution then please, "Kudos" and "Accept as Solution" for Token of Appreciation
Hi deep_popat, thanks for the reply. Forgive me being such a noob, is this setting to be applied to everyone (all users)?
Also for CentOS would you have access or know the commands for CLI for this?
Thanks a bunch!
Hello @aarondesig0cea
cd <your Magento install dir> // 644 permission for files find . -type f -exec chmod 644 {} \; // 755 permission for directory find . -type d -exec chmod 755 {} \; chmod 644 ./app/etc/*.xml chown -R :<web server group> . chmod u+x bin/magento
Try the above commands.
If you get the solution then please, "Kudos" and "Accept as Solution" for Token of Appreciation
.
Thanks for this, looks like the permissions are a bit different from what you said before?
Following these instructions give me the following error:
(im using the web server group :apache
Fatal error: Uncaught Zend_Cache_Exception: cache_dir "/home/default/html/var/page_cache" is not writable in /home/default/html/vendor/magento/zendframework1/library/Zend/Cache.php:209 Stack trace: #0 /home/default/html/vendor/magento/zendframework1/library/Zend/Cache/Backend/File.php(180): Zend_Cache::throwException('cache_dir "/hom...') #1 /home/default/html/vendor/colinmollenhour/cache-backend-file/File.php(87): Zend_Cache_Backend_File->setCacheDir('/home/default/h...') #2 /home/default/html/vendor/magento/zendframework1/library/Zend/Cache.php(153): Cm_Cache_Backend_File->__construct(Array) #3 /home/default/html/vendor/magento/zendframework1/library/Zend/Cache.php(94): Zend_Cache::_makeBackend('Cm_Cache_Backen...', Array, true, true) #4 /home/default/html/vendor/magento/framework/App/Cache/Frontend/Factory.php(156): Zend_Cache::factory('Magento\\Framewo...', 'Cm_Cache_Backen...', Array, Array, true, true, true) #5 /home/default/html/vendor/magento/framework/Cache/Frontend/Adapter/Zend.php(38): Magento\Framework\App\Cac in /home/default/html/vendor/magento/zendframework1/library/Zend/Cache.php on line 209
Any one have any insight regarding this?
Thanks!
- Setup user to run for php-fpm in /etc/php/7.4/fpm/pool.d/www.conf. Eg: user = myUserCurrent
- sudo chown
-R :apache /path/to/magento - Restart my server php-fpm
Please remove the generated directory using the following command...
rm -rf var/ generated/
and, give the permission of your file using the following command...
chmod -R 644
and, give the permission of your folder using the following command...
chmod -R 755
then run these below commands...
php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento setup:static-content:deploy -f php bin/magento indexer:reindex php bin/magento cache:flush
Thanks.