Stop Magento writing to /tmp
Aug 14, 2012 · 1 minute readCategory: magento
So some of us disagree when it comes to what should happen when magento cannot write to var/ in the webroot. Magento itself chooses to try /tmp/magento/ if the var/ folder is not writable. This can cause many issues and confusion. Not least of which emptying var/ and making it writable does not make magento start using it, if there’s already a /tmp/magento!
One preferable option is to force magento to just stop if it can’t write to var/ - here’s a simple way to do this, which is sneaky but really handy :-
cd /tmp
ln -s abracadabra-dangling-symlink magento
What that does is create a dangling symlink in /tmp/ called magento, which cannot be overwritten by a directory. Magento then simply stops. Stopping because of permissions errors is often preferable to continuing and causing later confusion and problems.