/    Sign up×
Community /Pin to ProfileBookmark

Hi, I couldn’t find this by searching, so I hope it hasn’t been asked before.

I was trying some sample code which needed the PEAR:?B classes:

[code=php]//require the PEAR :: DB classes.[/code]

which was right below

[code=php]require_once ‘DB.php’;[/code]

DB.php is located into [url]http://_webserver_/DB-1.7.6[/url].

I installed DB-1.7.6 and PEAR-1.4.0a12 in the root folder of my web directory. The pages that need the classes are also in the root folder.

So what include path do I put and in what files other than the sample one mentioned above?

Thanks in advance!

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@Stephen_PhilbinAug 07.2005 — Well if something's in the same directory then you could just use "./filename" or "filename".

like [code=php]include("filename");[/code]
Copy linkTweet thisAlerts:
@shanterusanauthorAug 07.2005 — Thanks for the reply. That works, as would absolute links (I'm an idiot, aren't I :S).

However, now instead of [CODE]Failed opening required 'DB.php' (include_path='.:/usr/local/lib/php')[/CODE] I get [CODE]Fatal error: Class db_error: Cannot inherit from undefined class pear_error in /webhost/toru/www/DB-1.7.6/DB.php on line 868[/CODE].

Line 868 is [code=php]class DB_Error extends PEAR_Error[/code].

There was a line elsewhere with the path to PEAR.php which I set correctly.

What's with that? ?
Copy linkTweet thisAlerts:
@Stephen_PhilbinAug 07.2005 — By the looks of it, that fatal error you got there is because the parent class of the extending class you're trying to call is unavailable. That might be because it simply doesn't exist, or is in another file and it needs including too.

In the document that you included this extending class into, try adding an include for the parent class immediately before the one you have now.

You have to include every single class file you are going to use in a script if you're not using the class autoloader. That includes that includes classes called conditionally, extending classes and normal classes alike.
×

Success!

Help @shanterusan spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...