Bug #52529 [Opn->Csd]: PDO+Mysqlnd MYSQL_ATTR_COMPRESS undefined

From: Date: Wed, 20 Oct 2010 07:24:56 +0000
Subject: Bug #52529 [Opn->Csd]: PDO+Mysqlnd MYSQL_ATTR_COMPRESS undefined
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-5280@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=52529&edit=1 ID: 52529 Updated by: kalle@php.net Reported by: ben at blazely dot com Summary: PDO+Mysqlnd MYSQL_ATTR_COMPRESS undefined -Status: Open +Status: Closed Type: Bug Package: Documentation problem Operating System: Ubuntu 10.04 PHP Version: 5.3SVN-2010-08-04 (snap) -Assigned To: +Assigned To: kalle Block user comment: N New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2010-10-20 09:24:39] kalle@php.net Automatic comment from SVN on behalf of kalle Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=304538 Log: Fixed bug #52529 (PDO+Mysqlnd MYSQL_ATTR_COMPRESS undefined) Documented missing constants for PDO_MYSQL * PDO::MYSQL_ATTR_COMPRESS * PDO::MYSQL_ATTR_FOUND_ROWS * PDO::MYSQL_ATTR_IGNORE_SPACE And some small clarifications about which ones are available using mysqlnd. ------------------------------------------------------------------------ [2010-08-05 14:08:18] johannes@php.net PDO_mysql never supported compression, compression support only was added to mysqlnd so it has all libmysql features. In general we don't overly encourage using compression as usually the bottleneck is more on the CPU than network. ------------------------------------------------------------------------ [2010-08-04 16:23:41] ben at blazely dot com I was aware that pdo_mysql did not support compression, however I thought that it was added in 5.3.2? I'm using 5.3.3. Was this not the case? If not then the documentation below may need to be changed as I found it a little misleading. From: http://www.php.net/manual/en/mysqlnd.overview.php Compressed Protocol Support As of PHP 5.3.2 MySQL Native Driver supports the compressed client server protocol. MySQL Native Driver did not support this in 5.3.0 and 5.3.1. Extensions such as ext/mysql, ext/mysqli, PDO_MYSQL, that are configured to use MySQL Native Driver, can also take advantage of this feature. ------------------------------------------------------------------------ [2010-08-04 11:14:39] kalle@php.net Its currently known as indicated in the sources that compression is unavailable in mysqlnd Assigned to the mysql team ------------------------------------------------------------------------ [2010-08-04 03:02:07] ben at blazely dot com Description: ------------ Client compression support was added to mysqlnd in php 5.3.3. PDO_mysql should now be able to use it. However the constant MYSQL_ATTR_COMPRESS is undefined in the PDO class when compiling using the following (bare minimum) config: ./configure --with-pdo-mysql=mysqlnd --with-mysql=mysqlnd Due to how recent this addition is, I can find no further information on php.net/google/anywhere... There are also some confusing (and useless?) switches in configure for mysqlnd compression that seem counter-intuitive. --disable-mysqlnd-compression-support Enable support for the MySQL compressed protocol in mysqlnd --with-zlib-dir[=DIR] mysqlnd: Set the path to libz install prefix When configure runs, it says that it has disabled mysqlnd compression support, however phpinfo() (post compile) shows that compression is available and that pdo_mysql is using mysqlnd. -- mysql MySQL Support => enabled Active Persistent Links => 0 Active Links => 0 Client API version => mysqlnd 5.0.7-dev - 091210 - $Revision: 300533 -- mysqlnd mysqlnd => enabled Version => mysqlnd 5.0.7-dev - 091210 - $Revision: 300533 $ Compression => supported SSL => supported Command buffer size => 4096 Read buffer size => 32768 Read timeout => 31536000 Collecting statistics => Yes Collecting memory statistics => No -- PDO PDO support => enabled PDO drivers => sqlite, sqlite2, mysql pdo_mysql PDO Driver for MySQL => enabled Client API version => mysqlnd 5.0.7-dev - 091210 - $Revision: 300533 $ Test script: --------------- <?php define("DATABASE_TYPE", 'mysql'); define("DATABASE_USERNAME", 'dbuser'); define("DATABASE_PORT", '3306'); define("DATABASE_HOST", 'db.server'); define("DATABASE_PASSWORD", 'dbpass'); define("DATABASE_DBNAME", 'dbname'); try { $o_dbh = new PDO( DATABASE_TYPE.":host=".DATABASE_HOST.";port=".DATABASE_PORT.";dbname=".DATABASE_DBNAME, DATABASE_USERNAME, DATABASE_PASSWORD, Array( PDO::MYSQL_ATTR_COMPRESS => true ) ); } catch (PDOException $o_e) { print $o_e->getMessage(); } Expected result: ---------------- No output, DB connection established, client compression enabled. Actual result: -------------- Error as follows: Fatal error: Undefined class constant 'MYSQL_ATTR_COMPRESS' in test.php on line 15 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=52529&edit=1

« previous php.doc.bugs (#5280) next »