Magento db connection parameters won't change, crazy caching? Magento db connection parameters won't change, crazy caching? database database

Magento db connection parameters won't change, crazy caching?


OK, this took me two days to track down. But what I found is either a bug, or a feature, I don't know.

The problem was that there was ANOTHER file in the 'magento/app/etc' directory, that was OVERRIDING the correct database connection parameters in the 'local.xml' file. This file was called 'localOLD.xml'. Obviously, someone wanted to backup our database settings for safety; a good idea. But apparently, Magento was reading THAT file instead of 'local.xml'.

I was really surprised that it started working as soon as I deleted that file. In fact, I did not believe it. So I made a copy of 'local.xml', called it 'localOLD.xml', entered some test values for the connection parameters, and Magento tried to use them.

Is this a bug or a feature? Anyone?


It's always a pain in the behind when this happens.

First — are you sure the production server is using the file system for its cache? Many production systems are setup to cache to something else like redis, memcache, etc. Clearing the cache through the admin UI or a tool like n98-magerun (if possible) is always a good idea.

Second — are you sure you're removing the correct cache folder? If Magento can't write to the var folder due to PHP permissions, it will store its cache files in the system temp folder.

Some debugging code in this method

#File: app/code/core/Mage/Core/Model/Config/Options.phppublic function getVarDir(){    //$dir = $this->getDataSetDefault('var_dir', $this->getBaseDir().DS.'var');    $dir = isset($this->_data['var_dir']) ? $this->_data['var_dir']        : $this->_data['base_dir'] . DS . self::VAR_DIRECTORY;    if (!$this->createDirIfNotExists($dir)) {        $dir = $this->getSysTmpDir().DS.'magento'.DS.'var';        if (!$this->createDirIfNotExists($dir)) {            throw new Mage_Core_Exception('Unable to find writable var_dir');        }    }    return $dir;}

Should reveal where Magento is loading it's file cache data from.

var_dump($dir);return $dir;


I was fighting with this for a while as well. I ended up moving all of my backed up local.xml files to another directory and that fixed it.Thanks