我遇到Magento安装问题,希望有人可以帮助我。
当我访问该网站时,我突然收到以下错误消息:
Fatal error: Class name must be a valid object or a string in /app/code/core/Mage/Core/Model/Resource.php on line 215
这指的功能是:
/**
* Get connection type instance
*
* Creates new if doesn't exist
*
* @param string $type
* @return Mage_Core_Model_Resource_Type_Abstract
*/
public function getConnectionTypeInstance($type)
{
if (!isset($this->_connectionTypes[$type])) {
$config = Mage::getConfig()->getResourceTypeConfig($type);
$typeClass = $config->getClassName();
$this->_connectionTypes[$type] = new $typeClass();
}
return $this->_connectionTypes[$type];
}
这是第215行:
$this->_connectionTypes[$type] = new $typeClass();
我搜索过有类似问题的人,但没有运气,所以我被困住了,真的需要解决这个问题
有人可以帮忙吗?
答案 0 :(得分:9)
我在这里遇到了同样的问题。 尝试添加
<type>pdo_mysql</type>
在连接节点内的 local.xml 文件中。它应该是这样的:
<default_setup>
<connection>
<host><![CDATA[localhost]]></host>
<username><![CDATA[your_user]]></username>
<password><![CDATA[your_pass]]></password>
<dbname><![CDATA[your_db]]></dbname>
<initStatements><![CDATA[SET NAMES utf8]]></initStatements>
<model><![CDATA[mysql4]]></model>
<type><![CDATA[pdo_mysql]]></type>
<pdoType><![CDATA[]]></pdoType>
<active>1</active>
</connection>
</default_setup>
在自动格式化xml配置文件时,还会尝试检查编辑器是否添加了换行符或空格。有时 type 节点(和其他节点)的值放在下面的行中,它会破坏解析。因此,请确保xml文件中的值周围没有空格或换行符。