简体   繁体   中英

wampserver php5.3.1 and Pear:DB problems

I've installed PHP5.3.1 on top of 5.3.0 on my Windows 7 Pro laptop. I've installed Smarty, Pear and the relevant Pear packages. I use a config.php file to set up my development site on Win separately from my production sites which run on Linux. I've checked phpinfo and everything is set up correctly.

Now when I try and open up my Home page (login page) on 5.3.1, It thinks for about a minute, doesn't load, leaving a blank screen, and generates no errors. I've tried hiding parts of the config file and the stumbling block appears to be:

require_once "DB.php";
$db = DB::connect("mysql://root:$dbpass@$dbhost/$dbname") or die("unable to connect to $dbhost");
$db_hw = DB::connect( "mysql://root:$dbpass@$dbhosthw/egret" ) or die("unable to connect to $dbhost_hw");

My service uses two different database servers. I'm not even getting the die("") statements displaying.

Any suggestions as to what might be wrong?

George

This is not working. In your case you overwrite the connection with the second connect. With mysql_connect or mysqli_connect you get a ressource back and you can handle your queries with the specified ressource:

How do you connect to multiple MySQL databases on a single webpage?

But when you use PEAR you access the same class DB::connect and this overwrites the db ressource and connection.

In your case you can call the disconnect() function before a new connection:

require_once "DB.php";
$db = DB::connect("mysql://root:$dbpass@$dbhost/$dbname") or die("unable to connect to $dbhost");
$db->disconnect();

$db = DB::connect( "mysql://root:$dbpass@$dbhosthw/egret" ) or die("unable to connect to $dbhost_hw");

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