阅读Larry Ullman的PHP5时,我被告知要安装Pear Auth包和Pear DB。
根据Pear网站的说法,DB包已经被弃用,取而代之的是MDB2。所以我安装了后一个(MDB2)包。
当我运行我的程序时,我得到了这个警告。
Fatal error: Class 'DB' not found in /Users/michaelmitchell/pear/share/pear/Auth/Container/DB.php on line 150我不确定我是否做错了什么(如果是,是什么?)或者,如果Auth包以某种方式引用了已弃用的DB类,或者其他什么?
if (!DB::isConnection($this->db)下面的第三行是DB.php的第150行。有人能帮上忙吗?
function _prepare()
{
if (!DB::isConnection($this->db)) {
$res = $this->_connect($this->options['dsn']);
if (DB::isError($res) || PEAR::isError($res)) {
return $res;
}
}
if ($this->options['auto_quote'] && $this->db->dsn['phptype'] != 'sqlite') {
if (strpos('.', $this->options['table']) === false) {
$this->options['final_table'] = $this->db->quoteIdentifier($this->options['table']);
} else {
$t = explode('.', $this->options['table']);
for ($i = 0, $count = count($t); $i < $count; $i++)
$t[$i] = $this->db->quoteIdentifier($t[$i]);
$this->options['final_table'] = implode('.', $t);
}
$this->options['final_usernamecol'] = $this->db->quoteIdentifier($this->options['usernamecol']);
$this->options['final_passwordcol'] = $this->db->quoteIdentifier($this->options['passwordcol']);
} else {
$this->options['final_table'] = $this->options['table'];
$this->options['final_usernamecol'] = $this->options['usernamecol'];
$this->options['final_passwordcol'] = $this->options['passwordcol'];
}
return true;
}发布于 2011-04-29 20:16:22
做
pear install --force --alldeps Auth自动重新安装所有必需的依赖项。
在您的脚本中,确保PEAR位于已配置的include_path中,可以由任何已配置的自动加载器找到,并且/或者手动包含所需的包。
发布于 2013-09-09 19:01:30
不要强迫安装DB,它已经被弃用了!在以下代码中更改该行代码:
if (!MDB2::isConnection($this->db)https://stackoverflow.com/questions/5831830
复制相似问题