3

I was changing my secure Base Skin URL, Base Media URL,Base JavaScript URL to a cdn url yesterday and had a typo, which messed everything up on Secure pages, including the Admin.

So I went in to DB and changed the core_config_data entries to correct it. Cleared my var/cache in my magento directory. And it kept showing the incorrect url for css,js and images.

When I looked in Admin -> Configuration -> Web the entries were all changed, so it was a caching issue.

I couldn't figure out where it was caching, because I would clear var/cache and then Magento would recreate the cache files in var/cache.

So eventually, I figured out that it was caching on the server at /tmp/magento/var/cache But the weird thing is, that it seems to cache in var/cache and /tmp/magento/var/cache It also seems to be doing this for sessions! And some logs go to /tmp/magento and some to var/log

I have var/cache in my magento directory set to 777

Any ideas why it is splitting the cache? why is going to tmp if I have var/cache set to 777?

  • So I found this (edmondscommerce.github.io/magento/…), which states that once /tmp/magento is created, Magento will keep using it. But why is some cache, logs... going to var/ in the Magento directory and some going to tmp? – Kevin Young Dec 15 '15 at 20:16
  • 1
    Almost always a permissions issue. If ./var or a path thereunder is not accessible, webserver temp dir may be used. – benmarks Dec 15 '15 at 22:14
5

If you don't have proper permissions on the var/ folders, Magento can write its cache information to the system /tmp folder.

This can lead to a situation where you've changed the base URLs in the Magento database, cleared cache (manual deletion of all mage-?? folders in var/cache), (cleared APC cache if you're running the op-code cache), (manually disabled the compiler (1.4.x.x and later)) and the system still looks for the original site.

Most people who own their own server discover that the site magically starts working after fixing, clearing and resetting permissions and then rebooting the server. The server reboot clears /tmp of the Magento cache files and Magento finally starts looking at its own configuration to find where it's located.

If you have this happen, set your var/ folder permissions so that both the login user and web server process can access the var/ folder tree. Then if you have permissions to navigate over to the /tmp folder, go delete the /tmp/magento folder. Pay particular attention to permissions on the subfolders var/cache/ and var/tmp/ must be writable by the web server process which may be running as www-data, nobody, etc.

Screen shots of this in action...

The Magento directory found in /tmp...

The Magento directory found in /tmp

And the Cache living in that directory. Note the path -> /tmp/magento/var/cache

Magento Cache subdirectories...

  • More on this situation over here => stackoverflow.com/questions/8940458/… – Fiasco Labs Dec 15 '15 at 20:42
  • Yes, this is what I concluded, thank you. But why does Magento continue to use tmp once I fix permissions on var/cache ? Is there an entry in the DB that tells Magento to keep using tmp even after permissions are correct on var/cache I looked in app/code/core/Mage/Core/Model/Config/Options.php and it doesn't seem to check if /tmp/Magento exists first – Kevin Young Dec 15 '15 at 20:52
  • 1
    Every instance of this issue I've ever created has been cleared by 1) putting the site in maintenance mode, 2) changing folder/file permissions to 775/664 for var/ and on down, 3) manually deleting the subfolders in var/cache/ and manually deleting /tmp/magento/ Also, if you have memcache, redis or the opcode cache, those need to be cleared as well. Then take it out of maintenance mode and everything initializes to the proper location. Where Magento stores its cache is found in app/etc/local.xml. I've never seen anything stored in the database that controls this. – Fiasco Labs Dec 15 '15 at 21:07
  • One last thing, when I fix this, can I just copy all the session files over to var/session directory, so I don't lose sessions? – Kevin Young Dec 15 '15 at 22:19
  • The owner and file permissions must match the original location if you do that, personally I'd choose the least busy time of the day, maintenance mode it and delete the sessions as well as the cache to give everything a fresh start. – Fiasco Labs Dec 15 '15 at 23:12

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.