?
Solved

What does this Class db_error mean?

Posted on 2005-04-10
15
Medium Priority
?
486 Views
Last Modified: 2011-10-03
I just installed a story building engine on a site and get this error:

Fatal error: Class db_error: Cannot inherit from undefined class pear_error in /home/NLS/public_html/stories/include/classes/pear/DB.php on line 622

Can someone enlighten me as to what this means basically and how I might go about resolving it?

The code area the above error message  is addressing is as follows:

class DB_Error extends PEAR_Error
{
    // {{{ constructor
    /**
     * DB_Error constructor.
     *
     * @param mixed   $code   DB error code, or string with error message.
     * @param integer $mode   what "error mode" to operate in
     * @param integer $level  what error level to use for $mode & PEAR_ERROR_TRIGGER
     * @param mixed   $debuginfo  additional debug info, such as the last query
     *
     * @access public
     *
     * @see PEAR_Error
     */

    function DB_Error($code = DB_ERROR, $mode = PEAR_ERROR_RETURN,
              $level = E_USER_NOTICE, $debuginfo = null)
    {
        if (is_int($code)) {
            $this->PEAR_Error('DB Error: ' . DB::errorMessage($code), $code, $mode, $level, $debuginfo);
        } else {
            $this->PEAR_Error("DB Error: $code", DB_ERROR, $mode, $level, $debuginfo);
        }
    }    
    // }}}      
}
0
Comment
Question by:Steve_Newbie
  • 8
  • 7
15 Comments
 
LVL 10

Expert Comment

by:kupra1
ID: 13750964
You are trying to create a child class "DB_Error" of class "PEAR_Error" by doing an "extends".
But either the class "PEAR_Error" doesn't exist or is not available in your subclass. check it out.
0
 

Author Comment

by:Steve_Newbie
ID: 13759332
Uh, thanks, but how do I do that?  I am not anywhere near a guru on this.  Please direct me to something I can reference on this procedure/process.  
Thanks.
S
0
 
LVL 10

Expert Comment

by:kupra1
ID: 13759556
Do you have your class "PEAR_error" in place first?
0
Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

 
LVL 10

Expert Comment

by:kupra1
ID: 13759604
Modify the DB.php file :
  require_once 'PEAR.php';
to
  require_once '..\PEAR.php';

Check whether in your "php.ini" file, you have the include path or not:
  include_path = ".;D:\server\php\pear"   //path of your pear.php


0
 

Author Comment

by:Steve_Newbie
ID: 13759689
OK, this might sound stupid, but here goes. Do you mean in the DB.php file?  If that is the case, no.  I don't think so.    I am sure I am way off.....sorry.  
SV
0
 
LVL 10

Expert Comment

by:kupra1
ID: 13759721
Did you include the package in which the Pear_error is? Look for that and include it.
0
 

Author Comment

by:Steve_Newbie
ID: 13759736
That produces:

Warning: main(..\PEAR.php): failed to open stream: No such file or directory in /home/NLS/public_html/stories/include/classes/pear/DB.php on line 26

I can't get to the php.ini on the host server, but I tried at set_ini to include the path and that did not work....no change.

?
0
 
LVL 10

Expert Comment

by:kupra1
ID: 13759833
In your DB_error class, include this line:

require_once("Pear_error.php");

Also check whether the PEAR database is installed or not?
0
 

Author Comment

by:Steve_Newbie
ID: 13759935
Yes the PEAR dbase is installed on the server.   Where exactly is the  line            
require_once("Pear_error.php");
supposed to go ?   Wherever I put it, the path is not right......


0
 

Author Comment

by:Steve_Newbie
ID: 13759944
In the DB.php file, there is the code area:  
class DB_Error extends PEAR_Error

But no  class DB-Error   per se.............
0
 
LVL 10

Expert Comment

by:kupra1
ID: 13760189
add this before your class definition class DB_Error extends PEAR_Error

<?
 require_once "Pear_Error.php"
//
class DB_Error extends PEAR_Error
//



?>
0
 

Author Comment

by:Steve_Newbie
ID: 13760232
Get this error:

Warning: main(Pear_Error.php): failed to open stream: No such file or directory in /home/NLS/public_html/stories/include/classes/pear/DB.php on line 626

Fatal error: main(): Failed opening required 'Pear_Error.php' (include_path='/home/NLS/public_html/stories/:/home/NLS/public_html/stories/include/classes:/home/NLS/public_html/stories/include/classes/pear:/home/NLS/public_html/stories/include/smarty:/home/NLS/public_html/stories/include:/home/NLS/public_html/stories/include/discuss:/home/NLS/public_html/stories/include/discuss/includes:/home/NLS/public_html/stories/include/lang') in /home/NLS/public_html/stories/include/classes/pear/DB.php on line 626
0
 
LVL 10

Accepted Solution

by:
kupra1 earned 1000 total points
ID: 13760253
can you check whether you have "Pear_Error.php" in your pear directory or its parent directory.
0
 

Author Comment

by:Steve_Newbie
ID: 13760286
OK, thanks for working throught this with me.  Found the problem after following some of your logic and mixing it with my rudimentary knowledge.  
The problem was the the pear.php file was corrupted.  I reinserted the correct code and the app works!  Thanks.
Will award points on last comment.
Thanks.
S
0
 
LVL 10

Expert Comment

by:kupra1
ID: 13760313
you are welcome.
0

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating and Managing Databases with phpMyAdmin in cPanel.
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month14 days, 14 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question