php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6383 DB Persistent Connection not re-used
Submitted: 2000-08-27 15:27 UTC Modified: 2000-11-02 03:45 UTC
From: Howard dot Cohodas at dkt dot com Assigned:
Status: Closed Package: MySQL related
PHP Version: 4.0 OS: NT4 SP6a
Private report: No CVE-ID: None
 [2000-08-27 15:27 UTC] Howard dot Cohodas at dkt dot com
Configuration...
php-4.0.2-dev-Win32-24-8-2000.zip
WinNT4 SP6a
HTTP Server: WebSitePro/2.5.4
mySQL: 3.23.22-beta
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Refer to Bug id #5807.  Seems similar.  If so then might be OS relateded, not mySQL or PostgreSQL related.

Script...

<html>
  <head>
    <title>DB Persistant Connection Test</title>
  </head>

  <body>
    <?php
      $db = mysql_pconnect ("localhost", "root")
              or die ("Could not connect");

      if (mysql_create_db ("myXdb")) {
        print ("Database created successfully");
      } else {
        printf ("Error creating database: %s", mysql_error ());
      }
      print "<br>";
	
      if (mysql_drop_db ("myXdb")) {
        print "Database dropped successfully";
      } else {
        printf ("Error dropping database: %s", mysql_error ());
      }
      print "<br>";
	
      mysql_close($db);

      show_source(__FILE__);
      phpinfo();
 
    ?>
  </body>
</html>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Problem..

Running WinMySQLadmin, observing Processes.
Each time the script is run another process is added th the process list.  The process goes into Sleep mode.

Rather than re-using the idle persistent connection, another process is created.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-30 09:32 UTC] Howard dot Cohodas at dkt dot com
Bug persists in PHP4.0.2.
 [2000-10-30 13:44 UTC] mathieu@php.net
You're using PHP in a CGI environment (php.exe gets ran)
Persistent Database connections are not possible for
obvious reasons.. It even says in the manual.
 [2000-10-30 14:45 UTC] mathieu@php.net
Reopened, sorry.. Misassumption on my behave

 [2000-10-30 17:12 UTC] jmoore@php.net
Your assumption that I was running in cgi mode is not accurate.  I may have
failed to mention it in the bug report, but a note to me before you closed
the bug would have cleared up the misunderstanding.

The problem:  In a Windows environment using the ISAPI version of PHP4 with
several data bases (MySQL, PostgreSQL) with several servers (IIS, WebSite
Pro), persistent connections are not reused and just accumulate forever or
whenever the db server is stopped and restarted, whichever comes first.

Howard A. Cohodas
Design Knowledge Technologies Inc.
Phone: (011)(330)492-9900
  FAX: (011)(330)492-1100
otfGIF Encoder: http://www.dkt.com/otfGIF

 [2000-11-02 03:45 UTC] kara@php.net
Connections can only be reused in the same process / thread. Since you cannot route requests to specific processes/threads, additional connections are opened while there would be other processes/threads available with already open connections.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Jul 11 09:00:01 2026 UTC