MikeMikeMike Posted April 29, 2011 Share Posted April 29, 2011 I got PEAR installed on my system. I'm working on Chapter 4, Authentication with Pear. Larry tells us to install Pear Auth package and also Pear DB. The Pear website says Pear DB is deprecated in favor of Pear MDB2, so I installed this latter package. However, when I ran login.php I got this warning Fatal error: Class 'DB' not found in /Users/michaelmitchell/pear/share/pear/Auth/Container/DB.php on line 150 Anyone have any idea what's going on here? This is the block of code referred to in the error message. The third line below starting if(!DB::.... is line 150 in the error message 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; } Link to comment Share on other sites More sharing options...
Jonathon Posted April 29, 2011 Share Posted April 29, 2011 Hi MikeMikeMike, Have you tried to install just the depreciated version? You might find that will still work to demonstrate the examples. The error is that the class being requesting doesn't exist I'm afraid. 1 Link to comment Share on other sites More sharing options...
MikeMikeMike Posted April 29, 2011 Author Share Posted April 29, 2011 Problem solved by entering this in the terminal pear install --force --alldeps Auth 1 Link to comment Share on other sites More sharing options...
Jonathon Posted April 29, 2011 Share Posted April 29, 2011 Glad you sorted it. I really sympathise with you when having trouble with PEAR. I've sadly completely broken my pear installer, but I'm getting a new set up shortly. So I'll take on some PEAR I missed again Link to comment Share on other sites More sharing options...
Larry Posted April 29, 2011 Share Posted April 29, 2011 Mike (*3), kudos for figuring it out and thanks for sharing the solution. I do believe that PEAR is failing to live up to its promise, and the Zend Framework may be a better alternative. It's easier to install, is kept updated, and can be used in pieces. I'll have to think about this when I go to do the third edition next year. Link to comment Share on other sites More sharing options...
Jonathon Posted April 29, 2011 Share Posted April 29, 2011 It is a shame that PEAR seems quite tricky, because it seems to have some wonderful segments of code. I actually note the comment above, that Zend may be a better option. When I was having trouble with my PEAR installation I was inside the depths of XAMPP and saw quite a few folders for ZEND, so maybe it comes included with XAMPP.. *UPDATE - I've just had a quick Google and apparently it is installed on XAMPP, however i'm not sure about MAMP, i've looked for all MAC users though. I've see it has Zend Optimizer 3.3.9 and eAccelerator 0.9.6. Not really sure what this means in terms of Zend i'm afraid, but maybe it could be useful to some people. Particulary if your using XAMPP on windows as it's pre-packaged* Link to comment Share on other sites More sharing options...
Larry Posted April 30, 2011 Share Posted April 30, 2011 Zend Optimizer comes with MAMP, but that's a separate thing than the Zend Framework, of course. Link to comment Share on other sites More sharing options...
Recommended Posts