|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-08-18 13:57 UTC] 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)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 15:00:02 2025 UTC |
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.