Edit report at http://bugs.php.net/bug.php?id=52529&edit=1

 ID:                 52529
 User updated by:    ben at blazely dot com
 Reported by:        ben at blazely dot com
 Summary:            PDO+Mysqlnd MYSQL_ATTR_COMPRESS undefined
 Status:             Assigned
 Type:               Bug
 Package:            PDO related
 Operating System:   Ubuntu 10.04
 PHP Version:        5.3SVN-2010-08-04 (snap)
 Assigned To:        mysql
 Block user comment: N

 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------
[2010-08-04 11:14:39] ka...@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

Reply via email to