How to include PEAR packages by only including the PEAR.php file?

Go To StackoverFlow.com

0

I'm using PEAR on a hosted website and I want to use the MDB2 package. Every site on the web initializes the MDB2 package with an require('MDB2.php'). Sadly, my web host only provides to me the location of the main PEAR.php file.

But I think I remember a method of including PEAR packages without specifically including them by file name, but using the global PEAR class by calling some static function. Sadly I ran through the documentation several times and tried to Google every combination of keywords that could help me find the solution but I didn't find it.
So, is this possible?? And if so, how do I do so??

Thanks a lot, I've been looking for multiple hours now :(

Steven

2012-04-05 21:35
by Steven Roose


1

No, it is not possible to load pear packages through the PEAR class.

The only official way to include a pear package is to require/include the file you want to use:

require_once 'MDB2.php';

Also, your web host probably will not have MDB2 installed, so you need to ship it yourself. See the installation on a shared host manual.

2012-05-21 13:14
by cweiske
Ads