In Magento 2 I get an error in my VPS ... is not writable in /vendor/magento/zendframework1/library/Zend/Cache.php:209

i tried set find . -type d -exec chmod 755 {} \; && find . -type f -exec chmod 644 {} \; && chmod u+x bin/magento but not success. Any suggestion?

I checked permissions in my site.

folder 755 file 644 owner/group nginx:nginx

in nginx.config user nginx; in php-fpm.config user: nginx group: nginx

somebody help me!

  • Try this way sudo find . -type d -exec chmod 755 {} \; – Magento 2 May 13 '17 at 7:24

You need to give permission to var folder and pub/static folder and user of that folder must be apache Check below command:

cd /var/www/html/magento2 && sudo find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \; && sudo find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \; && sudo chown -R :apache . && sudo chmod u+x bin/magento

Where /var/www/HTML/magento2 my magento directory.

| improve this answer | |
  • yep, I set permission 777 to pub/static and var folder. – xanka May 13 '17 at 6:54
  • Have you checked above code? – Sunil Patel May 13 '17 at 7:25
  • is it set recursively like chmod -R 770 var app/etc pub/static? Also your php must have writable access to files. If you are using apache or php-fpm them make sure user www-data has permission to write in magento var directory. After you do this do ls -shalt and review permissions – Abhishek Jakhotiya May 13 '17 at 7:28
  • @sunilpatel i were run this code. And I following devdocs.magento.com/guides/v2.1/install-gde/prereq/… – xanka May 13 '17 at 7:39
  • @xanda it is good article and I solved using that. Is that solved? – Sunil Patel May 13 '17 at 7:40

There are several reasons for this.

  1. Redhat based distros come with SELinux enabled. You have to either disable SELinux or update SELinux policies. Refer https://www.tecmint.com/disable-selinux-temporarily-permanently-in-centos-rhel-fedora/, http://devdocs.magento.com/guides/v2.0/install-gde/prereq/security.html
  2. Web server user should have enough permission to write files to the cache folder. If you are using PHP-FPM, PHP-FPM service user should have the permission. It might not be the same user as web server user.
| improve this answer | |
  • i'm tried 1,2. not success. I'm use PHP-FPM and in config listen.owner = nginx listen.group = nginx – xanka May 13 '17 at 7:34
  • Try sudo chown nginx:nginx -R . under Magento document root. – B G Kavinga May 13 '17 at 8:04

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.