ID: 49287 User updated by: shooreek at gmail dot com Reported By: shooreek at gmail dot com Status: Bogus Bug Type: MySQLi related Operating System: WinXP SP3 PHP Version: 5.3.0 New Comment:
Description: ------------ It seems like mysqli do not understand compression protocol. When you are using flag MYSQLI_CLIENT_COMPRESS in mysqli_real_connect - it connects, but can't properly handle server (compressed?) answer. MySQL server 5.0.67-community-nt-log with compression enabled: mysql> show variables like '%have_comp%'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | have_compress | YES | +---------------+-------+ 1 row in set (0.00 sec) I can connect to MySQL server using command line client with flag '-C' (use compression): C:\Documents and Settings\U>mysql -C Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 14 Server version: 5.0.67-community-nt-log MySQL Community Edition (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> show status like '%compr%'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | Compression | ON | +---------------+-------+ 1 row in set (0.00 sec) mysql> I think that something is wrong with mysqli and flag MYSQLI_CLIENT_COMPRESS Reproduce code: --------------- $mysqli = mysqli_init(); if (!$mysqli) { die('mysqli_init failed'); } if (!$mysqli->real_connect('localhost', '', '', NULL, NULL, NULL, MYSQLI_CLIENT_COMPRESS)) { die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error()); } $mysqli->query("show status like '%compre%'"); $mysqli->close(); Expected result: ---------------- Normal query execution without any errors. Actual result: -------------- PHP Some times it crushes. Sometimes it do not. Error log: PHP Warning: mysqli::query(): MySQL server has gone away in C:\Documents and Settings\U\Desktop\compress_test.php on line 42 PHP Warning: mysqli::query(): Error reading result set's header in C:\Documents and Settings\U\Desktop\compress_test.php on line 42 MySQL Error log: 090818 17:36:04 [Warning] Aborted connection 8 to db: 'unconnected' user: 'U' host: 'localhost' (Got a packet bigger than 'max_allowed_packet' bytes) sometimes: 090818 17:31:13 [Warning] Aborted connection 61 to db: 'unconnected' user: 'U' host: 'localhost' (Got an error reading communication packets) =============== Correct documentation, please, if it is a feature request. Previous Comments: ------------------------------------------------------------------------ [2009-08-26 09:09:16] u...@php.net Duplicate of http://bugs.php.net/bug.php?id=47017 . Feature request. ------------------------------------------------------------------------ [2009-08-18 15:14:35] j...@php.net This is most likely mysqlnd issue since PHP 5.3 binaries for win32 use mysqlnd. ------------------------------------------------------------------------ [2009-08-18 13:57:43] shooreek at gmail dot com Description: ------------ It seems like mysqli do not understand compression protocol. When you are using flag MYSQLI_CLIENT_COMPRESS in mysqli_real_connect - it connects, but can't properly handle server (compressed?) answer. MySQL server 5.0.67-community-nt-log with compression enabled: mysql> show variables like '%have_comp%'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | have_compress | YES | +---------------+-------+ 1 row in set (0.00 sec) I can connect to MySQL server using command line client with flag '-C' (use compression): C:\Documents and Settings\U>mysql -C Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 14 Server version: 5.0.67-community-nt-log MySQL Community Edition (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> show status like '%compr%'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | Compression | ON | +---------------+-------+ 1 row in set (0.00 sec) mysql> I think that something is wrong with mysqli and flag MYSQLI_CLIENT_COMPRESS Reproduce code: --------------- $mysqli = mysqli_init(); if (!$mysqli) { die('mysqli_init failed'); } if (!$mysqli->real_connect('localhost', '', '', NULL, NULL, NULL, MYSQLI_CLIENT_COMPRESS)) { die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error()); } $mysqli->query("show status like '%compre%'"); $mysqli->close(); Expected result: ---------------- Normal query execution without any errors. Actual result: -------------- PHP Some times it crushes. Sometimes it do not. Error log: PHP Warning: mysqli::query(): MySQL server has gone away in C:\Documents and Settings\U\Desktop\compress_test.php on line 42 PHP Warning: mysqli::query(): Error reading result set's header in C:\Documents and Settings\U\Desktop\compress_test.php on line 42 MySQL Error log: 090818 17:36:04 [Warning] Aborted connection 8 to db: 'unconnected' user: 'U' host: 'localhost' (Got a packet bigger than 'max_allowed_packet' bytes) someimes: 090818 17:31:13 [Warning] Aborted connection 61 to db: 'unconnected' user: 'U' host: 'localhost' (Got an error reading communication packets) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49287&edit=1