2011-04-29 3 views
2

Larry UllmanのPHP 5を読んで、Pear AuthパッケージとPear DBもインストールするように言われました。Pear Auth package

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)の3行目は、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 

を行います。

スクリプトでは、設定されたinclude_pathにPEARが含まれていることを確認し、設定されたオートローダーによって検出され、必要なパッケージを手動で組み込むことができます。

+0

おかげで、私はちょうど認証のためのパッケージの名前を代入して、問題を持っているすべてのパッケージにそのコマンドを使用することができますと仮定しますか? – Leahcim

+0

@マイケルはい。追加のコマンドについては、http://pear.php.net/manual/en/を参照してください。また、コマンドプロンプトで 'pear --help'と入力してください – Gordon

0

DBのインストールを強制しないでください。廃止予定です!内のコードの行を変更します。

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