title: Php getting too many connections error from MySQL
body: <p>I am using MySQL and PHP with 2 application servers and 1 database server.
  With the increase of the number of users (around 1000 by now), I'm getting the following error :</p>
  
  <pre><code>SQLSTATE[08004] [1040] Too many connections
  </code></pre>
  
  <p>The parameter <code>max_connections</code> is set to <code>1000</code> in <code>my.cnf</code> and <code>mysql.max_persistent</code> is set to <code>-1</code> in <code>php.ini</code>.</p>
  
  <p>There are at most 1500 apache processes running at a time since the <code>MaxClients</code> apache parameter is equal to 750 and we have 2 application servers.</p>
  
  <ul>
  <li>Should I raise the <code>max_connections</code> to 1500 as indicated <a href="https://stackoverflow.com/questions/2229974/sqlstate08004-1040-too-many-connections">here</a>?</li>
  <li>Or should I set <code>mysql.max_persistent</code> to 750 (we use PDO with persistent connections for performance reasons since the database server is not the same as the application servers)?</li>
  <li>Or should I try something else?</li>
  </ul>
  
  <p>Thanks in advance!</p>