|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57137 SQL query generates Too Many Connections error
Submitted: 2006-07-11 16:55 UTC Modified: 2006-07-13 14:15 UTC
From: eric at uoregon dot edu Assigned:
Status: Not a bug Package: PDO (PECL)
PHP Version: 5.1.4 OS: RHEL AS 3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: eric at uoregon dot edu
New email:
PHP Version: OS:


 [2006-07-11 16:55 UTC] eric at uoregon dot edu
The following problem occurred on a machine using PHP 5.1.4 
with PDO 1.0.3 and MySQL 5.0.22. The PHP version dropdown 
menu in the bug report form does not have options for 5.1.3 
or above.

While running a simple query that contained the MySQL CONCAT
() function in the SELECT clause the following error was 

Database Connection Error: SQLSTATE[08004] [1040] Too many 

The server did not have too many connections at the time the 
query was run. There were 13 MySQL processes running out of 
a potential 100. 

The query took the following form:

SELECT CONCAT(field1, '-', field2) AS field1_field2 FROM 

If the new field name after the AS keyword is changed to 
something else, like: field1field2 then the query works.

The initial query works if it's run in the mysql client with 
the same permissions as the web application. The query also 
works when using the built-in PHP MySQL or MySQLi extension 

I was only able to produce this error on my linux machines. 
I tried the same initial query, with the same AMP stack, on 
a Mac OS X (10.4.7) machine and the query did not complain 
of "Too Many Connections".

In the table I have set-up, field1_field2 corresponds to the 
name of an index on the table. Since changing the name to 
something that does not match table's index fixes the query, 
perhaps PDO registers some sort of collision and 
misinterprets this as a 'Too Many Connections' error. 

Again, I want to stress that when the query is run there are 
NOT too many connections to the server. Memory and disk 
space usage is nominal as well.


Eric Anderson 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-13 14:15 UTC] eric at uoregon dot edu
Never mind. This was an error in my code. A database 
connection call was being run in a loop and generating the 
error. However, MySQL was not logging the multiple 
connection attempts.

At any rate, it is not a PDO or PHP bug. 

Sorry for anyone's time this may have wasted.

Eric Anderson
 [2009-02-12 22:52 UTC] josearmerlin at yahoo dot com
SQL query generates Too Many Connections error

How solve this problem.Is there any php code to stop the connection in runntime.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Sep 24 12:01:24 2020 UTC