Link to home
Start Free TrialLog in
Avatar of movieprodw
movieprodw

asked on

PHP, Pear.php question

Hello,

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:

require_once("PEAR.php");
require_once("DB.php");

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!
<?php
 
 
require_once("PEAR.php"); 
require_once("DB.php"); 
 
 
define("DB_CONNECT_ERROR","A DATABASE CONNECTION COULD NOT BE ESTABLISHED");
define("DB_CONNECT_ERROR_NUM",1);
 
//start db connect class
class dbroot extends PEAR { 
 
var $dsn = "mysql://u_usr:pass@localhost/ha_db";
 
function dbroot(){
	$this->PEAR();
	$this->connect = DB::connect($this->dsn);
	if (DB::isError($this->connect)) {    
	header("location:/error.php?db_error=true");
		return  $this->raiseError(DB_CONNECT_ERROR, DB_CONNECT_ERROR_NUM);
	}
}
 
function _dbroot(){
	$this->_PEAR();
}
 
 
}// end class
 
?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of dazweeja
dazweeja

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of movieprodw
movieprodw

ASKER

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

c:\php\go-pear

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!