PHP, Pear.php question

Posted on 2009-04-18
Last Modified: 2013-12-12

I have inherited a website and I am trying to post it on my server but it is unable to connect to a couple of files:


There are no files on the sever by that name so I am really confused, I copied every file/folder from the old server and copied it over so I am not sure what to do.

I would love your input!





//start db connect class

class dbroot extends PEAR { 

var $dsn = "mysql://u_usr:pass@localhost/ha_db";

function dbroot(){


	$this->connect = DB::connect($this->dsn);

	if (DB::isError($this->connect)) {    


		return  $this->raiseError(DB_CONNECT_ERROR, DB_CONNECT_ERROR_NUM);



function _dbroot(){



}// end class


Open in new window

Question by:movieprodw
    LVL 3

    Accepted Solution

    When you include/require a file and don't specify a folder path, ie. require_once("PEAR.php"), it will first look in the PHP 'includes' directory and then if it doesn't find it there, it will look in the same folder as the PHP file that contains the require/include. If the script you are using worked on the previous server, it's likely that the files that aren't being found on your new server were in the 'includes' directory.

    The default 'includes' directory is c:\php\includes on Windows and /php/includes on Unix.

    To find the includes directory on a server look in the php.ini file for the line that starts with 'include_path =' or you can create a PHP info page that will tell you all the PHP configuration details, eg. create a PHP page that contains only the following:


    If both setups on your new and old server are pretty standard and you're using Windows, you can probably solve your problem by copying the contents of c:\php\includes on your old server to c:\php\includes on your new server. If that doesn't work and the folder structure is identical on both new and old servers, check to make sure the include path in the php.ini files on both servers are the same and modify if necessary.
    LVL 1

    Author Comment

    Thank you so much for that, I did not know any of that!

    Seriously, thank you!

    I will award points for the explanation and post another question if I can not solve it still.
    LVL 3

    Expert Comment

    My pleasure. Two other things which may come in handy. If you make any changes to php.ini, you'll have to restart your Apache or IIS service for these to take effect. Secondly, if you get this problem solved but then receive messages about PEAR not being installed (you can usually tell if it is or not by looking for a folder called PEAR in your PHP install directory - it's an option when you install PHP so it's not always installed), you can install PEAR (on Windows) by clicking Start->Run... and typing:


    You may have to change this command slightly if you have PHP installed in a different directory. When you are installing PEAR, you'll get a bunch of different prompts but usually pressing ENTER to select the default is adequate. Again, restart the web service for this to take effect.

    Good luck!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
    If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
    The viewer will learn how to count occurrences of each item in an array.
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now