I have got a couple of custom scripts running on my server to extract CSV files from a template. These files are sometimes 250,000 + lines. When i reach around this point I get this error.
Warning: Error while sending QUERY packet. PID=24022
This is linked to the packet size in the mysql query not been big enough.
I increased the mysql query size with the below, it seemed to improve it but not all the way.
SHOW VARIABLES LIKE 'max_allowed_packet';
set global max_allowed_packet=1073741824;
set global net_buffer_length=1048576;
I am using a dedicated server and have lots of resource so i could increase this but am unsure how much is safe + not really sure if this is the best way to handle the situation
Below is the code that i am using (i have removed a lot of the code that is just confusing)
$br = ']'; //this changes
$handle = fopen($path."".$inputFileName, "r");
while (($data = fgetcsv($handle, 0, "".$br."")) !== FALSE)
{
....... my code .... based on $data["...
This issue was my scripts (many) where taking a long time to run. Basically i just reconnected to Mysql. All comments were here helpful