douzhou7124 2012-11-22 14:53
浏览 41

wampserver php5.3.1和Pear:DB问题

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

  • 写回答

1条回答 默认 最新

  • dsdioa9545 2012-11-22 15:15
    关注

    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");
    
    评论

报告相同问题?

悬赏问题

  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?