PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, August 31, 2022

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

 August 31, 2022     include, mdb2, pear, php     No comments   

Issue

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


Solution

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.



Answered By - cweiske
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing