title: Fgets stops after 130 lines PHP
body: <pre><code>    $done=0;
      $filename = "raw_urls.txt";
      if(! ($fhandle = fopen($filename, "r")))
  { echo "File failed to open"; 
      Exit; }
      //
      //  main loop reads sitemap url list
      //
      while($url_full_raw = fgets($fhandle,4096))
      {
      print (mysql_error());
  
  $url_full= preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $url_full_raw);
  if(strlen($url_full) &gt; 3)
  {
      $url_stat++;
      //  Echo ' tp1 Url from sitemap:',$url_stat,' - ' ,$url_full,'&lt;br&gt;';
      $end_st = strlen($url_full)-29;
      $s_url= substr($url_full,29,$end_st);
      //Echo 'short:',$s_url,'&lt;br&gt;';
      $url_full_raw= '';
  }
  else{
      $done++;
      Echo '----------- short string ---------------';
  }
  //
  //        Check for url
  //
  $res1=sql("SELECT * FROM `spy3` WHERE `Landingpage` LIKE '%$s_url%' LIMIT 0, 30 ",$o);
  if($row=mysql_fetch_array($res1))
  {
      $lp=$row[6];
      $found++;
      //  Echo '-------&gt;Url from sitemap:',$url_full,'&lt;br&gt;';
  }
  else{
      Echo 'Not Found:-&gt; ',$s_url,'&lt;br&gt;';
      $nfound++;
  }
  sql("insert into sitemap (url, stat_url,nf, s_recno) 
  values (
  '$url_full',
  '$lp',
  '$nfound',
  '$url_stat'
  )", $o);
  print (mysql_error());
  $found=0;
  $nfound=0;
  </code></pre>
  
  <p>}</p>
  
  <p>So the code works great. Except for one problem, after about 130 lines, it stops. It exits the program with no error. Yes full error reporting is on. PHP.ini memory is huge. 
  If I edit the txt file and take out some lines, no difference. I have been working on this for many hours. </p>