Error Got a packet bigger than max allowed packet bytes

0 votes

Hi I am getting the error :

Got a packet bigger than 'max_allowed_packet'bytes

but I made no changes in my source code and the hosting states that they did not made any change in server settings.

I don't know what happened. But I am trying to find the reason.

so, how to check max_allowed_packet mysql variable by php script?

and is that possible to set it in source code?

Sep 1, 2020 in PHP by kartik
• 37,510 points
4,609 views

1 answer to this question.

0 votes

Hello @kartik,

max_allowed_packet is set in mysql config, not on php side

[mysqld]
max_allowed_packet=16M 

You can see it's curent value in mysql like this:

SHOW VARIABLES LIKE 'max_allowed_packet';

You can try to change it like this, but it's unlikely this will work on shared hosting:

SET GLOBAL max_allowed_packet=16777216;

Hope it works!!
Thank You!!

answered Sep 1, 2020 by Niroj
• 82,880 points

Related Questions In PHP

+1 vote
1 answer

ERROR: Cannot add or update a child row: a foreign key constraint fails

Hello @kartik, You are getting this constraint check ...READ MORE

answered Aug 20, 2020 in PHP by Niroj
• 82,880 points
29,298 views
0 votes
1 answer

PHP Error: Function name must be a string

Hello @kartik, It should be $_COOKIE['name'], not $_COOKIE('name') $_COOKIE is an array, ...READ MORE

answered Nov 4, 2020 in PHP by Niroj
• 82,880 points
3,288 views
0 votes
1 answer

Error: Field 'display_name' doesn't have a default value

Hello @kartik, MySQL is most likely in STRICT ...READ MORE

answered Nov 13, 2020 in PHP by Niroj
• 82,880 points
1,388 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,880 points
21,704 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,880 points
2,630 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,880 points
2,486 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,880 points
41,147 views
0 votes
1 answer

Error:Lost connection to MySQL server at 'reading initial communication packet', system?

Hello, You have to follow the below steps: bind-address ...READ MORE

answered Apr 9, 2020 in PHP by Niroj
• 82,880 points
20,338 views
0 votes
2 answers

Error:“Cannot Connect to Server - A network-related or instance-specific error”?

Hello, The "sql server error 40" is appears mostly ...READ MORE

answered Aug 18, 2020 in PHP by Fantazma
• 140 points
28,018 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP