title: How to use Persistent Connection of PDO?
body: <p>I have the following code and freshed this webpage in Firefox for 5 times, then the MySQL showed me 5 connections. According to the PDO Manual, </p>
  
  <blockquote>
    <p>Persistent connections are not closed
    at the end of the script, but are
    cached and re-used when another script
    requests a connection using the same
    credentials. The persistent connection
    cache allows you to avoid the overhead
    of establishing a new connection every
    time a script needs to talk to a
    database, resulting in a faster web
    application.</p>
  </blockquote>
  
  <p>I have used the same credentials, but the number of MYSQL connection keep increasing.  Even trying to close connection with <code>$db = null</code> could not close the connections.
  What's wrong of my code?</p>
  
  <pre><code>&lt;?php
  try {
   $dbh = new PDO('mysql:host=127.0.0.1;dbname=lingtong', 'root', 'xxxxxx', array(PDO::ATTR_PERSISTENT =&gt; true));
   foreach ($dbh-&gt;query('SELECT * from agent') as $row) 
    print_r($row);
   $dbh = null;
  } catch (PDOException $e) {
   print "Error! : " . $e-&gt;getMessage() . "&lt;br/&gt;";
   die();
  }
  </code></pre>