From: kushmit at gmail dot com Operating system: redhat PHP version: 4.3.10 PHP Bug Type: MySQL related Bug description: database connection handling flawed
Description: ------------ Currently the way that mysql handles multiple DB connections on a single server is not ready for prime time. It appears that mysql shares all connections wth the same (or even different) parameters. Either way, it is impossible to use PHP and mysql for serious DB apps without a way to explicitly: 1. open a connection to a specific DB 2. use the connection PRIVATELY 3. close the connection to the specific DB Currently, PHP and mysql do not allow this. There is a certain level of connection sharing that ALWAYS occurs. This is extremely bad design. If connections are implicitly shared and there is no way to establish a private connection, then in a multiuser environment, where there are many pieces of shared code making modifications to several databases, it is impossible to predict what connections are "active" at a given point in time. Relying upon a "reference count", which is essentially a 2-dimensional representation of connection status, in an environment where multiple programs are opening and closing multiple connections to multiple DBs results in unpredictable behavior. The whole idea that all the Db connections on a given server should be managed by incrementing and decrementing a counter is beyond belief IMHO - it will not work for nay but the simplest of scripts. In addition, the current mysql_close function DOES NOT perform the typical housecleaning operations that would be expected of a "close" function (all it does is decrement a DB reference count; no resources are freed; no DB connection is actually closed). Several people have reported this as a bug, but it keeps getting closed (?!?). IT IS A BUG. Not being able to explicitly open and close DB connections is a HUGE HOLE IN FUNCTIONALITY. If no one wants to fix mysql_close, the function's name should at least be changed to "mysql_decrease_reference_count" so people are not misled into thinking that they can actually programmatically control DB connections... -- Edit bug report at http://bugs.php.net/?id=33613&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33613&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33613&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33613&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=33613&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=33613&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33613&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33613&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33613&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33613&r=support Expected behavior: http://bugs.php.net/fix.php?id=33613&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33613&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33613&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=33613&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33613&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=33613&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33613&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33613&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33613&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33613&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33613&r=mysqlcfg