cancel
Showing results for 
Search instead for 
Did you mean: 

Uncaught Zend_Cache_Exception: cache_dir with chmod 777

Uncaught Zend_Cache_Exception: cache_dir with chmod 777

I've tried for a little while now to install Magento on my server, but I have had a lot of troubles doing so. The latest issue that I haven't been able to find a good answer to is the following error:

Fatal error: Uncaught Zend_Cache_Exception: cache_dir "/var/www/<install_dir>/magento/var/cache/" is not writable in /var/www/<install_dir>/magento/vendor/magento/zendframework1/library/Zend/Cache.php:209 Stack trace: #0 /var/www/<install_dir>/magento/vendor/magento/zendframework1/library/Zend/Cache/Backend/File.php(180): Zend_Cache::throwException('cache_dir "/var...') #1 /var/www/<install_dir>/magento/vendor/colinmollenhour/cache-backend-file/File.php(87): Zend_Cache_Backend_File->setCacheDir('/var/www/<insta...') #2 /var/www/<install_dir>/magento/vendor/magento/zendframework1/library/Zend/Cache.php(153): Cm_Cache_Backend_File->__construct(Array) #3 /var/www/<install_dir>/magento/vendor/magento/zendframework1/library/Zend/Cache.php(94): Zend_Cache::_makeBackend('Cm_Cache_Backen...', Array, true, true) #4 /var/www/<install_dir>/magento/vendor/magento/framework/App/Cache/Frontend/Factory.php(156): Zend_Cache::factory('Magento\\Framewo...', 'Cm_Cache_Backen...', Array, Array, true, true, true) #5 /var/www/<install_dir>/magento/vendor/magento/fram in /var/www/<install_dir>/magento/vendor/magento/zendframework1/library/Zend/Cache.php on line 209

When looking for answers, I have seen suggestions to try doing `chmod 777`, which I have already done (obviously for making sure that there are no permission conflicts, I don't do it when the site goes live), but the error still appears. What am I doing wrong here?

3 REPLIES 3

Re: Uncaught Zend_Cache_Exception: cache_dir with chmod 777

Hello @rubendahln8ab1 ,

 

Check the user from which your nginx/apache is running.

Use the same user/group in your file system.

* check the user by below command 

ps aux | grep nginx
// based on your server
ps aux | grep apache

and change the owner ship of files with same user and group :

chown -R USER:GROUP {PATH TO PROJECT FOLDER}

Hope it helps !

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy

Re: Uncaught Zend_Cache_Exception: cache_dir with chmod 777

When I do

sudo chown -R www-data:www-data .

in the project folder, it goes from an uncaught error to "The page isn't redirecting properly". The access log spits out

<ip> - - [18/Jun/2021:19:41:45 +0000] "GET / HTTP/1.1" 302 5818 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0"

and the error log is blank. They are configured as such:

ErrorLog <directory>/error.log
CustomLog <directory>/access.log combined

in Apache.

 

This is another error I have encountered before, with no obvious solution when I have looked around.

 

Re: Uncaught Zend_Cache_Exception: cache_dir with chmod 777

I definitely enjoy every little bit of it and I have you bookmarked to check out new stuff of your blog a must read blog!