I have a magento and all caches are turned on, why is var/cache empty? I can only empty the cache from the backend, but when this is broken, I have a problem.

Where does magento write the cache files?

  • It could also be a permissions/user/group issue.
    – Dan Norris
    Commented Jun 25, 2015 at 14:09

6 Answers 6


Could also be you are using a different cache storage like memcached, Redis

  • yes, if magent use redis / memcached as cache store then it does not save at var/cache folder
    – Amit Bera
    Commented Jun 25, 2015 at 12:48
  • Where does it save then?
    – Black
    Commented Mar 5, 2019 at 11:39

If you have a var dir or even a var/cache dir, but Magento can't write to it, Magento will use sys_get_temp_dir() to determine a good place to put the caching files.

Often this is /tmp/ and results in /tmp/magento/var/cache (Thanks to fschmengler)

  • 5
    in this case the cache dir is /tmp/magento/var/cache Commented Jun 25, 2015 at 12:46
  • can you please look at magento.stackexchange.com/questions/94638/… and reply. I hope you can give enough info
    – Anto S
    Commented Dec 22, 2015 at 8:01
  • it really help me
    – Amit Bera
    Commented Jun 6, 2016 at 7:39
  • Instead of writing thankful comments please upvote, to leave the comment area for "real" comments and questions please :) Commented Jun 6, 2016 at 7:51
  • i was already done this at past .. so no upvote this time :)
    – Amit Bera
    Commented Jun 6, 2016 at 7:58

I ran into this problem when magento writes it cache file to /tmp/magento/var/cache folder.

This is weird issue, I had solved this SELinux issue by following command.

$ sudo restorecon -R /var/www/html
$ sudo setsebool -P httpd_unified 1

To whom it affects. Any file that ends with ".xml" can and will be used.
It is not enough to just rename the XML file to something like oldsomething.xml you must do something like local.xml.back where the file does not end a with dot XML. Leaving local.xml and oldlocal.xml will load both files.

I don't know enough about the inner workings to know why this is, but I have tested it to know it is true. You can prove this by putting in something that will break Magento in the renamed XML, and Magento stops working.

Maybe the Magento code does not discriminate the file name but just the extension in a certain location?

My website is still on Magento
Too shy to update (it ain't broke) but I did put the 1.8 Redis part in and it seems to work. I am testing but not ready for prime time yet as some of my extensions no longer work.

Try https://github.com/steverobbins/Magento-Redismanager. I like it you may like it too!

  • For your information Magento load .xml files in Mage_Core_Model_Config in function loadBase(). It takes all .xml with the PHP function glob() at the begining $files = glob($etcDir.DS.'*.xml'); Commented Feb 17, 2016 at 14:56

Manage to solve the issue and it's the weirdest thing ever. When I change the local.xml to fix the issue I put a backup of the old file saying local_back.xml. I just delete that file and now everything is working fine. No idea why Magento pick that file up. Anyways issue has been solved.

  • 1
    Because magento is loading every xml file in app/etc/ as you can see in \Mage_Core_Model_Config::loadBase Commented Jun 26, 2015 at 10:36
  • i have bigin magento devloper Commented Jun 26, 2015 at 10:46

Perhaps someone is not understanding what is happening or my answer, as in the other commits Magento is going to load all that ends with ".xml". So if you want backups or copies that are not used appending back or backup or anything else WILL NOT WORK!

back_local.xml will not work

If you want copies or backups you need to change the suffix of the file name, or in other word in the format of "local.xml.backup or kill the .xml altogether. I use local.xml.backup as a copy while I am testing, as I can easily remove the ".backup" to use it if I want. You can always use 'Save As' in an editor for different versions, like .back_today, or .back2 and such.

For your information Magento load .xml files in Mage_Core_Model_Config in function loadBase(). It takes all .xml with the PHP function glob() at the begining $files = glob($etcDir.DS.'*.xml'); – Matthéo Geoffray Feb 17 '16 at 14:56

So while testing different backends use the above format.

As for APC memcached, they are outdated and do not use keys like Redis. From what I understand there is no significant difference between


[files], [db], [memcache] or other cache as it seems to be more of a situation of the server response time and/or hard drives used on the server. See: "Magento Session Storage: Which to Choose and Why?"

When My VPS (InMotion) changed to strictly Solid State Hard drives everything was tremendously faster. I was getting Milli-second transfers!

On my own test servers at home the one box that uses HST 10k spindle speed and a boat load of cache, like 64 MB (Marked for server use), hard drive is very fast and the other box very slow with the Hard drives you get from an OEM box.

Also having 8 CPU cores and 32GB of RAM helps alot. So much of what is offered on-line as a VPS or even dedicated server is a cheat!!! You need to get into the details or the resources you will get as Unlimited means nothing if the server is in reality shared hosting passed off as something else. And don't let the Pictures mislead you as to what their facility might really be. You might get something like Hillary got for her email, just something in a bathroom closet. The hook is they often want a year or more contract to get the good price and it could take a month or more to optimize your setup before you learn you are just on a slow server!!!

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.