What causes max-allowed packet issue in drupal 7. We have set the max_allowed_packet size to 1024mb (1gb). Still we are facing the problem in quick intervals. Also dblog module is not working even after enabling it from database.

Drupal version: 7.22

MySql version: 5.1.7

Using APC, Memcache and Varnish for caching.

[Edit]: We noticed that max_allowed_packet the value gets reset to 1mb automatically.

Please Help.

  • 1
    We noticed that max_allowed_packet the value gets reset to 1mb automatically. you might find your hosting provider doesn't let you override that setting. If you're on shared hosting that's almost definitely going to be the problem, as you need to restart the MySQL daemon after making the change, and no shared hosting would let you do that. Ask your host for more information – Clive Dec 31 '15 at 9:37
  • 2
    I'm voting to close this question as off-topic because this is a hosting issue and not related to Drupal. – leymannx Oct 16 '19 at 10:14

Please check this below option

  1. Login to mysql, run below query

SHOW VARIABLES LIKE 'max_allowed_packet'

it will give you the packet size.

For set packet size

SET GLOBAL max_allowed_packet=16000000;

  1. Custom module for set packet size : https://www.drupal.org/node/379976

If you go to the file; database.mysqli.inc in the folder /includes

and search for this line;

trigger_error(check_plain(mysqli_error($active_db) ."\nquery: ". $query), E_USER_WARNING);

it occurs at about line 134

and simply comment it out, by changing it to this

// trigger_error(check_plain(mysqli_error($active_db) ."\nquery: ". $query), E_USER_WARNING);

you will solve the problem.

  • Sorry but no such file is present. Can you please elaborate the file location. – echo Dec 31 '15 at 8:36
  • are you worked in localhost? – Anaz Dec 31 '15 at 8:39
  • /etc/mysql/my.cnf max_allowed_packet = 64M changed it to 32M – Anaz Dec 31 '15 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.