php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30584 cannot connect to mysql server after sending a number of concurrent requests
Submitted: 2004-10-27 16:40 UTC Modified: 2004-10-27 18:56 UTC
From: it at videinfra dot lv Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.3.9 OS: Win Server 2003, Win XP Pro
Private report: No CVE-ID: None
 [2004-10-27 16:40 UTC] it at videinfra dot lv
Description:
------------
We met the same problem recently, when we developed a project running on Win2003. We got cannot connect error when we tested server's productivity. We used Apache JMeter to simulate 10 concurrent connections. Initially, we thought that it is because of big amount of queries we run at the first page. To make sure this is not because of the number of queries, we created simple PHP script that creates connection to MySQL, runs simple query like SELECT title FROM pages WHERE id = 1 and closes connection. The result was the same. We moved the script and MySQL to a Linux server and repeated the test. We did not get the error. We repeated the test with PHP on windows and MySQL on Linux and the error came again. So, when we run PHP script on windows platform, we got the error everytime irrespective MySQL location.

Reproduce code:
---------------
<?
$t1 = time();
$conn = mysql_connect ( '10.0.1.4', 'root', '') or die("Could not connect: " . mysql_error());
mysql_select_db('lub2', $conn);
$res = mysql_query("SELECT title FROM pages_lv0 WHERE id = 1", $conn) or die("Invalid query: " . mysql_error()); 
mysql_close($conn);
$t2 = time();
echo $t2 - $t1 . "<br />";
?>



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-27 18:46 UTC] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

You are probably reaching the maximum allowed mysql connections on your MySQL server. This is a MySQL setting you can change.
 [2004-10-27 18:56 UTC] it at videinfra dot lv
Initially, I thought it might be MySQL problem. I used the same MySQL server when I run test on Linux and Win platforms. Settigns in php.ini on both platforms in MySQL section are the same.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 23 04:01:32 2024 UTC