Pear 认证包
在阅读 Larry Ullman 的 PHP 5 时,我被告知要安装 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;
}
Reading Larry Ullman's PHP 5, I was told to install Pear Auth package and also Pear DB.
According to Pear website, the DB package has been deprecated in favor of MDB2. So I installed this latter (MDB2) package.
I'm getting this warning when I run my program.
Fatal error: Class 'DB' not found in /Users/michaelmitchell/pear/share/pear/Auth/Container/DB.php on line 150
I'm not sure if I have done something wrong (if so, what?) or if the Auth package is somehow referring to the deprecated DB class, or something else?
The third line below if (!DB::isConnection($this->db)
is line 150 of DB.php. Can anyone help?
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;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
执行
自动重新安装所有必需的依赖项。
在脚本中,确保 PEAR 位于配置的 include_path 中,并且可以由任何配置的自动加载器找到和/或手动包含所需的包。
Do
to automatically reinstall with all required dependencies.
In your script, make sure PEAR is in the configured include_path and can be found by any configured autoloaders and/or include the required packages manually.
不要强制安装 DB,它已被弃用!更改该行代码:
Don't force to install DB, it's deprecated! Change that line of code in: