title: mysqli_query() : "mysql server has gone away" and "Error reading result set's header" on uploads >3M
body: <p>I have both error in the title when I'm trying to upload a file bigger then about 3 megabytes to my server.</p>
  
  <p>Here is what I tried in <code>my.ini</code>:</p>
  
  <pre><code># The MySQL server
  [wampmysqld]
  SET SESSION wait_timeout=28800
  SET GLOBAL wait_timeout=28800
  interactive_timeout=3000
  wait_timeout=3000
  mysql.connect_timeout = 1000
  port        = 3306
  socket      = /tmp/mysql.sock
  key_buffer_size = 16M
  max_allowed_packet = 100M
  sort_buffer_size = 8K
  net_buffer_length = 512K
  read_buffer_size = 256K
  read_rnd_buffer_size = 512K
  myisam_sort_buffer_size = 8M
  basedir=c:/wamp/bin/mysql/mysql5.6.17
  log-error=c:/wamp/logs/mysql.log
  datadir=c:/wamp/bin/mysql/mysql5.6.17/data
  
  [mysqld]
  SET SESSION wait_timeout=28800
  SET GLOBAL wait_timeout=28800
  max_allowed_packet = 100M
  interactive_timeout=3000
  wait_timeout=3000
  port=3306
  explicit_defaults_for_timestamp = TRUE
  </code></pre>
  
  <p>and in <code>php.ini</code>:</p>
  
  <pre><code>; Maximum allowed size for uploaded files.
  ; http://php.net/upload-max-filesize
  upload_max_filesize = 500M
  </code></pre>
  
  <p>The table containing the file has <code>longblob</code> data type for the content. I still have these errors after these changes. What should I do?</p>