简体   繁体   中英

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM