title: fgets error on big cvs files
body: <p>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.</p>
  
  <blockquote>
    <p>Warning: Error while sending QUERY packet. PID=24022 </p>
  </blockquote>
  
  <p>This is linked to the packet size in the mysql query not been big enough.</p>
  
  <p>I increased the mysql query size with the below, it seemed to improve it but not all the way.</p>
  
  <pre><code>    SHOW VARIABLES LIKE 'max_allowed_packet';
      set global max_allowed_packet=1073741824;
      set global net_buffer_length=1048576;
  </code></pre>
  
  <p>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</p>
  
  <p>Below is the code that i am using (i have removed a lot of the code that is just confusing)</p>
  
  <pre><code> $br = ']'; //this changes
   $handle = fopen($path."".$inputFileName, "r");
   while (($data = fgetcsv($handle, 0, "".$br."")) !== FALSE) 
       {
      ....... my code .... based on $data["...
  </code></pre>