2011-04-29 72 views
2

阅读拉里乌尔曼的PHP 5,我被告知安装梨Auth包和梨数据库。梨认证包

据Pear网站介绍,DB软件包已被弃用,以支持MDB2。所以我安装了后者(MDB2)包。

我在运行程序时收到此警告。

Fatal error: Class 'DB' not found in /Users/michaelmitchell/pear/share/pear/Auth/Container/DB.php on line 150 

我不知道如果我做错了(如果是的话,是什么?),或者如果验证包以某种方式指的是过时的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; 
    } 

回答

2

pear install --force --alldeps Auth 

与所有必需的依赖自动重新安装。

在您的脚本中,确保PEAR在配置的include_path中,并且可以通过任何配置的自动加载器找到并/或手动包含所需的软件包。

+0

谢谢,我想我可以在任何包上使用该命令我有一个问题,只是用Auth代替包的名称? – Leahcim 2011-04-29 12:27:05

+0

@Michael是的。请参阅http://pear.php.net/manual/en/和/或在命令提示符下输入“pear --help”以获取其他命令 – Gordon 2011-04-29 12:28:21

0

不要强制安装DB,它已弃用!更改该行的代码在:

if (!MDB2::isConnection($this->db)