Note that there are some explanatory texts on larger screens.

plurals
  1. POphp, mysql - Too many connections to database error
    text
    copied!<p>Good day to all. I have an odd error. I have created a chat that works like this: </p> <ul> <li>questions/answers are inserted into a db</li> <li>every 2 seconds an ajax request is sent to a php script that fetch the new questions/answers</li> </ul> <p>It worked fine until today when I got this error:</p> <pre><code>Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [1040] Too many connections' in /var/www/html/dbdev/include/Zend/Db/Adapter/Pdo/Abstract.php:129 Stack trace: #0 /var/www/html/dbdev/include/Zend/Db/Adapter/Pdo/Abstract.php(129): PDO-&gt;__construct('mysql:host=loca...', '', '', Array) s#1 /var/www/html/dbdev/include/Zend/Db/Adapter/Pdo/Mysql.php(96): Zend_Db_Adapter_Pdo_Abstract-&gt;_connect() s#2 /var/www/html/dbdev/include/Zend/Db/Adapter/Abstract.php(448): Zend_Db_Adapter_Pdo_Mysql-&gt;_connect() s#3 /var/www/html/dbdev/include/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract-&gt;query('select profile_...', Array) s#4 /var/www/html/dbdev/include/Zend/Db/Adapter/Abstract.php(782): Zend_Db_Adapter_Pdo_Abstract-&gt;query('select profile_...', Array) s#5 /var/www/html/dbdev/include/Profile.php(43): Zend_Db_Adapter_Abstract-&gt;fetchPairs('select profile_...') s#6 /var/www/html/dbdev/public_html/index.php(29): Profile-&gt;load() s#7 {main} Next exception 'Zend_Db_Adapter_Exception' with in /var/www/html/dbdev/include/Zend/Db/Adapter/Pdo/Abstract.php on line 144 </code></pre> <p>The problem is that we were not that many... (8) and I don't think the db could not support more than 8 to 16 connections simultaneously (on specifications is written that the chat must support 50-100 users so 8 is... small). </p> <p>So... can any1 tell me why did this happen (yesterday we were 15 and worked fine) and how to solve it? Thank you for your help. If you need any code samples just ask. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload