I am working with Magento 1.7 and suddenly I have this error when I go to cache management:

cache_dir must be a directory

I tried this solution to change this file lib/Zend/Cache/Backend/File.php

'cache_dir' => 'null' to 'cache_dir' => 'tmp/' but does not work

  • what is you config in local.xml? do you have any specific settings for cache? – FlorinelChis Sep 11 '13 at 9:46
  • i don't use setting cache in local.xml – Amirov Sep 12 '13 at 10:59
  • Create /var/tmp folder and give 777 file permission. This will solve your issue. – Vinoth Oct 10 '15 at 7:07

Go to location lib/Zend/Cache/Backend/ and open file.php and change: null to NULL


protected $_options = array(
    'cache_dir' => NULL,
    'file_locking' => true,
  • I thougt the cache_dir error was about /var/cache, but it seems about something else. Can you explain whats going on because this fixed my problem. – Akif Sep 11 '15 at 14:28

Make sure that your var and var/cache directories are writable.
The issue generally arises when var directory is not writable.

  • var and var/cache directories are writable (all privileges 777) – Amirov Sep 11 '13 at 12:25
  • Also Check permissions for media directory, if works then good or Try this - Go to location lib/Zend/Cache/Backend/ and open file.php and change 'cache_dir' => 'null', to 'cache_dir' => 'full path to magento root directory/tmp' – Anshu Mishra Sep 11 '13 at 12:47
  • I have the same problem :( – Amirov Sep 11 '13 at 14:27
  • I tried all solutions searched but i have the same problem – Amirov Sep 13 '13 at 13:47

from Magento CE1.4 the 'cache_dir' value should be NULL without the quotes.

Also make sure the var/cache directory exists and is writeable and try and create a writeable tmp dir in your root.

I think this post might be related to your issue

  • but i have this error when cache_dir=>null – Amirov Sep 11 '13 at 9:29
  • In your question the value is 'null', I've had this before with a upgrade where I had to change it to null. Also make sure that this file isn't overwritten in the local code dir :) – Sander Mangel Sep 11 '13 at 9:32
  • I re-edit my cache_dir=>'null' as default and i don't understand what file in the local dir ? – Amirov Sep 11 '13 at 9:42
  • Zend libraries can be overwritten from app/code/local/Zend/... – Sander Mangel Sep 11 '13 at 9:43
  • i don't have Zend libreries in app/code/local – Amirov Sep 11 '13 at 9:46

Finally I found a little strange solution. I just add a new directory magento/null (777) in magento and it's resolved my problem.

It's strange

  • In that case it was expecting the path to a directory as a string. I bet if you change it to 'var/cache' it'll work with the old caching directory. – Sander Mangel Sep 13 '13 at 14:43
  • yes it's true it's work with 'var/cache'. Why other solutions does not work with me? can you explain me? – Amirov Sep 13 '13 at 14:49
  • and you're sure it doesn't work if you change the value to null without quotes around it? – Sander Mangel Sep 13 '13 at 14:49
  • without cache_dir=>null doesn't work and with cache_dir=>'null' it's work when i add null directory in magento root – Amirov Sep 13 '13 at 14:53
  • Hm very strange, well good it works now – Sander Mangel Sep 13 '13 at 14:56

In my case multiple instances of Magento are running in different directories so absolute paths were required instead of relative paths in lib/Zend/Cache/Backend/File.php.

Relative: 'cache_dir' => 'var/tmp/'

Absolute: 'cache_dir' => '/var/www/domain.com/var/tmp/'

This is a sample server environment, yours will be different so don't copy that line.

var/tmp already existed and permissions didn't matter. The issue in my case is a configuration apparently from the installation. When running a diff from command line on the /downloader/ directory there are inconsistencies in the *.cfg files in the instances where the Magento Connect (/downloader/) would not display.


Open /lib/Zend/Cache/Backend/File.php. Line 99 'cache_dir' => 'var/tmp/'

So Magento is trying to refer /var/tmp/ folder and either it couldn't be able to read or write this folder.

So you got 2 solutions,

Solution 1: Give 777 file permission to /var/tmp/ folder.

Solution 2: Open /lib/Zend/Cache/Backend/File.php. Change line 99 to 'cache_dir' => 'null'

Hope this helps.


I just created a /tmp directory in my Magento 1.7 root, and gave it 777 permissions. Magento didn't have permission to create the /tmp directory itself.

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.