php, mysql - Too many connections to database error -
good day all. have odd error. have created chat works this:
- questions/answers inserted db
- every 2 seconds ajax request sent php script fetch new questions/answers
it worked fine until today when got error:
uncaught exception 'pdoexception' message 'sqlstate[hy000] [1040] 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->__construct('mysql:host=loca...', '', '', array) s#1 /var/www/html/dbdev/include/zend/db/adapter/pdo/mysql.php(96): zend_db_adapter_pdo_abstract->_connect() s#2 /var/www/html/dbdev/include/zend/db/adapter/abstract.php(448): zend_db_adapter_pdo_mysql->_connect() s#3 /var/www/html/dbdev/include/zend/db/adapter/pdo/abstract.php(238): zend_db_adapter_abstract->query('select profile_...', array) s#4 /var/www/html/dbdev/include/zend/db/adapter/abstract.php(782): zend_db_adapter_pdo_abstract->query('select profile_...', array) s#5 /var/www/html/dbdev/include/profile.php(43): zend_db_adapter_abstract->fetchpairs('select profile_...') s#6 /var/www/html/dbdev/public_html/index.php(29): profile->load() s#7 {main} next exception 'zend_db_adapter_exception' in /var/www/html/dbdev/include/zend/db/adapter/pdo/abstract.php on line 144
the problem not many... (8) , don't think db not support more 8 16 connections simultaneously (on specifications written chat must support 50-100 users 8 is... small).
so... can any1 tell me why did happen (yesterday 15 , worked fine) , how solve it? thank help. if need code samples ask.
there bunch of different reasons "too many connections" error.
check out faq page on mysql.com: http://dev.mysql.com/doc/refman/5.5/en/too-many-connections.html
check my.cnf file "max_connections". if none exist try:
[mysqld] set-variable=max_connections=250
however default 151, should okay.
if on shared host, might other users taking many connections.
other problems out use of persistent connections , running out of diskspace.
Comments
Post a Comment