Jump to content

Recommended Posts

Hi All,

I'm a PHP intermediate, but a newbie with PEAR.

Trying to get started using PEAR but having problems:

i.e. When trying to use DB in a script:

[code]
require_once('DB.php');
[/code]

but I get this error:

[code]Fatal error: Undefined class name 'pear' in /usr/lib/php/DB.php on line 540[/code]

That would tell me that DB is being found, but a dependency for DB (ostensibly PEAR) is not.

So I go to command line and type:

[code]pear package-dependencies DB[/code]

and get:

[code]Cannot open 'DB' for parsing[/code]

I don't know exactly what that means but it doesn't sound good. (I tried running the same command as sudo).

But when I do:

[code]pear list[/code]

everything seems peachy:

[code]
Installed packages, channel pear.php.net:
=========================================
Package              Version State
Archive_Tar          1.3.1   stable
Console_Getopt       1.2     stable
DB                   1.7.6   stable
DB_Pager             0.7     stable
DB_Table             1.2.1   stable
Date                 1.4.6   stable
HTML_Common          1.2.2   stable
HTML_QuickForm       3.2.5   stable
HTML_Template_IT     1.1.3   stable
HTTP                 1.4.0   stable
Mail                 1.1.9   stable
Net_SMTP             1.2.8   stable
Net_Socket           1.0.6   stable
Net_UserAgent_Detect 2.1.0   stable
PEAR                 1.4.7   stable
PHPUnit              1.3.2   stable
Pager                2.3.6   stable
XML_Parser           1.2.7   stable
XML_RPC              1.4.5   stable
[/code]

and no problems installing new modules either. It's just that when I try to run DB in a script, it can't seem to "find" the base PEAR class?

So then just for kicks I add a second include, so it's like this:

[code]
require_once('PEAR.php');
require_once('DB.php');
[/code]

which gives me this error:

[code]
Fatal error: Class db_error: Cannot inherit from undefined class pear_error in /usr/lib/php/DB.php on line 868
[/code]

So now it's got the pear module but not the pear_error class?

Any ideas? Thanks in advance.
Link to comment
https://forums.phpfreaks.com/topic/4163-pear-newbie-questions/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.