1

Suddenly I am getting the following error on my website : Depoto.

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

3 Answers 3

1

"/opt/bitnami/apps/magento/htdocs/var/cache/" is not writable in

/opt/bitnami/apps/magento/htdocs/vendor/magento/zendframework1/library/Zend/Cache.php:209 Stack trace: #0

Looks like you got problem with permissions.

Refer this

and remeber to run that as web server user :)

like:

www-data

but this would be based on your server configuration.

1
  • @TejaBhagavanKollepara, ask your server administrator.
    – Black
    Jan 11, 2020 at 10:59
0

it is due to the ownership issues. I was using ubuntu os so I used the following command to correct ownership.

sudo useradd magento

Now associate this magento user to the web server’s user group. In ubuntu it is by default www-data

sudo usermod -g www-data magento

Now navigate the Magento project directory in the terminal and run following commands.

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 magento:www-data . 

 sudo chmod u+x bin/magento

Once these commands run successfully then magento user have all required permission whatever Magento setup needed.

Restart the apache server by the following command

sudo systemctl restart apache2

-1

Go to Magento root directory using below command

cd /opt/bitnami/apps/magento/htdocs

And run below commands

chmod -R 777 var/ pub/

Hope this will work for you.

1
  • 777 allows EVERY user to access these folders and data inside. This is a security risk and can leak important stuff. Especially if you are on a shared hoster. He has to change the owner instead.
    – Black
    Jan 11, 2020 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.