title: Solving "MySQL server has gone away" errors
body: <p>I have written some code in PHP that returns the html content from .edu domains. A brief introduction is given here: <a href="https://stackoverflow.com/questions/8688232/errors-regarding-web-crawler-in-php">Errors regarding Web Crawler in PHP</a></p>
  
  <p>The crawler works fine when the number of links to crawl are small (something around 40 URLS) but I am getting "MySQL server has gone away" error after this number.</p>
  
  <p>I am storing html content as longtext in MySQL tables and I am not getting why the error arrives after at least 40-50 insertions.</p>
  
  <p>Any help in this regard is highly appreciated.</p>
  
  <p>Please note that I have already altered the wait_timeout and max_allowed_packet to accomodate my queries and the php code and now I don't know what to do. Please help me in this regard.</p>