go to bug id or search bugs for
The MYSQLI_OPT_READ_TIMEOUT option cannot be changed after a connection is established. This means if it is set to a low value to ensure a stable initial connection to the MySQL server, it cannot be raised back up again before executing long running queries.
$connection = mysqli_init();
//ensure we receive a reply from mysql in under 1 second
//connect to the mysql server
$connection->real_connect($server, $username, $password, $database);
//change timeout to 1 hour so we can run a long query
//attempt to pull results from a very large table, something that would exceed the initial 1 second timeout value, but not the 1 hour timeout value
$connection->query('SELECT * FROM `huge_table`');
Add a Patch
Add a Pull Request
I'm searching the PHP-src source code and find some clue, the MYSQLI_OPT_READ_TIMEOUT option will be only assigned to the php_stream is at the establish connection and then reassign the option value but the php_stream's option is not will be reassigned.