The site started throwing exceptions on both the front & backend. After disabling redis, memcached & the full page cache and reverting to using files for sessions, the site seems to function correctly. However, when running the following code:
$var_dir = Mage::getModel('core/config')->getVarDir();
echo $var_dir;
Magento prints out
/tmp/magento/var
I believe this is what was causing the original issue. I read the following article –
Stop Magento Writing to /tmp – which mentions:
Magento itself chooses to try /tmp/magento/ if the var/ folder is not writable.
I checked the permissions on the folder & they are set correctly to 755 (I even tried changing this to 2755) & the owner is also correctly set. Even though that is the case, Magento still doesn't see said directory as writeable. (For interest sake, nor does it see the app/etc/modules
directory as writeable.
I've spoken with the host & we attempted to stop PHP & restart apache after removing the /tmp/magento
directory, but Magento just created it again.
Has anybody seen this behaviour before? How can I correct it so that Magento starts writing to the correct webroot var/
directory?
Best Answer
This is not an answer but a push in the right direction.
Take a look at the method
Mage_Core_Model_Config_Options::getVarDir()
obviously for you the first
if (!$this->createDirIfNotExists($dir)) {
fails while trying to create thevar
folder in your magento instance if that one does not exist.So if your folder exists, check why that call does not recognize it and if it doesn't exist check why it can't create it.
Maybe the
var
folder is a simlink and php does not recognize it as a folder (this shouldn't happen, but I'm just writing what ever I can think of). So try debuggingcreateDirIfNotExists
from the same class I mentioned above.