php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13716 Cannot open 'multiple' database connections while running from shell
Submitted: 2001-10-17 13:43 UTC Modified: 2001-10-17 13:57 UTC
From: chuckc at sonic dot net Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.0.5 OS: redhat
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
37 - 5 = ?
Subscribe to this entry?

 
 [2001-10-17 13:43 UTC] chuckc at sonic dot net
I'm trying to open multiple database connections to a 'non-local' mysql server from the shell.

It is important to note that this problem only occurs while running from the shell.  When running the same code from the web server, there is no problem.

#!/usr/bin/php 
<?php

//connect to database 1
$link_a = mysql_connect ("server", "uname1", "pword1")
    or die ("Could not connect to db1n");
print ("Connected to db1 successfullyn");

//connect to database 2
$link_b = mysql_connect ("server", "uname2", "pword2")
    or die ("Could not connect to db2n");
print ("Connected to db2 successfullyn");

?>

It does not matter which database you try to connect to first.  Regardless, the first connection succeeds, the second connection fails.


Some output:
Connected to domains successfully
<br>
<b>Warning</b>:  MySQL Connection Failed: Can't connect to MySQL server on spiff (111)
 in <b>./qtest.php</b> on line <b>23</b><br>
Could not connect to users db


I compiled PHP like so:
./configure --with-mysql=/opt/mysql --with-gd --prefix=/opt/php-4.0.5 --sysconfdir=/opt/php-4.0.5/etc --with-zlib-dir=/usr/local/ --
with-dom=/usr/local/lib/libxml12.so --with-mcrypt=/usr/local/lib/libmcrypt.so --with-cybercash=/opt/mck-3.2.0.4-linux --enable-force
-cgi-redirect

Thanks,
chuckc@sonic.net

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-17 13:57 UTC] sander@php.net
Submitted twice.
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Jun 05 20:03:39 2023 UTC