Learn how to a build a cloud-first strategyRegister Now


PHP, Pear.php question

Posted on 2009-04-18
Medium Priority
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
  • 2

Accepted Solution

dazweeja earned 2000 total points
ID: 24177814
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.

Author Comment

ID: 24177843
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.

Expert Comment

ID: 24177906
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!

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month21 days, 6 hours left to enroll

810 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