I am trying to add a grid in admin side. I am getting this error

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

enter image description here

I have tried

sudo chmod 777 -R /opt/lampp/htdocs/magento2.2.5/
php bin/magento setup:static-content:deploy -f
sudo chmod 777 -R /opt/lampp/htdocs/magento2.2.5/var/page_cache
  • check the link may help you click here Commented Sep 6, 2018 at 11:04
  • Hi, I have already referred it. @CharulTyagi Commented Sep 6, 2018 at 11:06
  • Go to your var/ directory and set permission specially for page_cache directory to 777. Commented Sep 6, 2018 at 11:12
  • sudo chmod 777 -R /opt/lampp/htdocs/magento2.2.5/var/page_cache i did this @CharulTyagi Commented Sep 6, 2018 at 11:14
  • Have you checked permission for root,var.page_cache directory that it is successfully set or not? Commented Sep 6, 2018 at 11:22

2 Answers 2


I have faced same type of error few days ago.

You can fix it by following ways..

chmod 777 -R var/ generated/(root access if don't have root access try with sudo)

NP: *****you need to give permission every time when you use below cmd.*****

php bin/magento cache:flush

So, you need to give proper permission of your application . you can follow below links.

Check this link


You can fix it by following ways..

 chown www-data -R /var/www/html/root

Your Answer

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

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