Joris
Joris

Reputation: 6296

How to increase PHP PDO max buffer size when using mysqlnd?

I am using php 5.6 in a project, and employing PDO to access a remote mysql database (on AWS).

I am encountering the following error:

SQLSTATE[08S01]: Communication link failure: 1153 Got a packet bigger than 'max_allowed_packet' bytes

At first sight I though this would be easy to fix, by simply setting MYSQL_ATTR_MAX_BUFFER_SIZE as an attribute to the PDO constructor, but it seems that value is not supported as PDO is compiled against mysqlnd

Can anyone tell me how to increase the buffer size in this case? I don't seem to find it.

Thanks

Upvotes: 0

Views: 2107

Answers (2)

Antariksh
Antariksh

Reputation: 518

This change is required in MySql config not in Php.

in my.ini or my.cnf add these lines,

[mysqld]
max_allowed_packet=16M 

To check the configuration you can do this :

SHOW VARIABLES LIKE 'max_allowed_packet';

Upvotes: 0

Joris
Joris

Reputation: 6296

It seems this can be solved by changing max_allowed_packet on the mysql server configuration.

Upvotes: 1

Related Questions