Edit report at https://bugs.php.net/bug.php?id=60716&edit=1
ID: 60716 Comment by: marc-bennewitz at arcor dot de Reported by: markrose at markrose dot ca Summary: Ability to set PDO connection timeout in milliseconds Status: Open Type: Feature/Change Request Package: PDO related Operating System: n/a PHP Version: 5.4.0RC5 Block user comment: N Private report: N New Comment: I would like it because 1second can be a long time if you would like to connect to a failover server you have minimum of 2x1 seconds. Sure if it's not possible with libmysql it's a MySQL-BUG only but for mysqlnd (and other db driver) it could be done. The simplest way would be to allow a float value as timeout and if the driver supports it use it else round it up to the next second. Previous Comments: ------------------------------------------------------------------------ [2012-05-02 07:32:47] u...@php.net For the MySQL part this can be considered Bogus/Not a bug because PHP is the wrong place to ask for it. Please, file a bug at MySQL. The underlying MySQL C API does not offer sub second granularity for setting the connect timeout. If it was to be fixed, it should be done at the lowest level which is the MySQL C API. No matter whether we are talking mysqlnd or MySQL Client Library (libmysql). See also http://dev.mysql.com/doc/refman/5.6/en/mysql-options.html and http://blog.ulf-wendel.de/?p=273 For the PDO part, I am not too keen of driver specific settings. What's the purpose of PDO if not providing an abstraction for it... However, for years now PDO seems kind of neglected, nobody feeling too much responsible for it. ------------------------------------------------------------------------ [2012-01-11 17:20:38] markrose at markrose dot ca Description: ------------ I'd like the ability to set PDO's connection timeout (to MySQL specifically) in milliseconds. The lowest the timeout can current be set to is 1 second, which is an extremely long time to wait for a database machine to reply. I run a synchronously replicated MySQL environment (Galera), and I'd like to be able to move on to the next machine if the database doesn't respond in say, 10 ms. Instead, PHP waits one second. This reduces the throughput of my PHP scripts from several hundred per second to only a handful per second, severely impacting performance and quickly exhausting the PHP thread pool, leading to timeouts. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60716&edit=1