title: Error log file feof(),fgets() using PHP
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php">Reference - What does this error mean in PHP?</a>  </p>
  </blockquote>
  
  
  
  <p>I have the <code>PHP</code> code as below:</p>
  
  <pre><code>&lt;?php
  $PMTA = $_GET['PMTA'];
  //Get current date
  $date = date('Y-m-d');
  // Declare variables
  $chart = array();
  $title = "";
  $domain = "";
  $total = array();
  $fail = array();
  $cate = array();
  $orderChart = array();
  $container ="";
  $dormain_str = array(); 
  // End declare variable 
  
  //Use switch for getting the text files                 
      switch($PMTA){
          case 1:
  
              if(file_exists('../pmta/stats_domain_emetteur_recepteur.unitead.info.'.$date.'.txt'))
              {
                  $file = '../pmta/stats_domain_emetteur_recepteur.unitead.info.'.$date.'.txt';
              }
              else
              {
                  $file = 'file_exits/stats_domain_sender_blank.txt';
              }
              break;
          case 2:
  
              if(file_exists('../pmta/stats_domain_emetteur_recepteur.frdcrp.com.'.$date.'.txt'))
              {
                  $file = '../pmta/stats_domain_emetteur_recepteur.frdcrp.com.'.$date.'.txt';
              }
              else
              {
                  $file = 'file_exits/stats_domain_sender_blank.txt';
              }
              break;
          case 3:
  
              if(file_exists('../pmta/stats_domain_emetteur_recepteur.affinitead.net.'.$date.'.txt'))
              {
                  $file = '../pmta/stats_domain_emetteur_recepteur.affinitead.net.'.$date.'.txt';
              }
              else
              {
                  $file = 'file_exits/stats_domain_sender_blank.txt';
              }
              break;
          case 4:
  
              if(file_exists('../pmta/stats_domain_emetteur_recepteur.switchcall.com.'.$date.'.txt'))
              {
                  $file = '../pmta/stats_domain_emetteur_recepteur.switchcall.com.'.$date.'.txt';
              }
              else
              {
                  $file = 'file_exits/stats_domain_sender_blank.txt';
              }
              break;
          case 5:
  
              if(file_exists('../pmta/stats_domain_emetteur_recepteur.unitead.eu.'.$date.'.txt'))
              {
                  $file = '../pmta/stats_domain_emetteur_recepteur.unitead.eu.'.$date.'.txt';
              }
              else
              {
                  $file = 'file_exits/stats_domain_sender_blank.txt';
              }
              break;
  
      }
  
                  // Open the file and read data
                  $files = fopen($file,'r');
                  // Start i = 0  
                  $i = 0;
                  // Check for the end of file has been reached,if have any error or end of file it will return true, other will return false
                  while(!feof($files)){
                      // It breaks the string in file that seperate by ; into array, so $data will become an array
                      $data = explode(";",fgets($files));
                      // Determind wheather the data is not empty or not
                      if(!empty($data[6])){
                          $domain = $data[6];
                              if(!empty($_POST['txt_order_blue'])){                                       
                                  $orderChart[$domain][] =array("success" =&gt; (100 - $data[9]),"fail" =&gt;(float)$data[9],"cate" =&gt; $data[5]);                                       
                              }
                                  // Else if click on button order by % failed        
                              else{
                                  $orderChart[$domain][] =array("fail" =&gt;(float)$data[9],"success" =&gt; (100 - $data[9]),"cate" =&gt; $data[5]);   
                             }                             
                          $i++;
  
                      }   
  
                  }
  
  ?&gt;
  </code></pre>
  
  <p>When I run in local it works fine,but when I run it on the server it show the message</p>
  
  <pre><code>[Thu Dec 27 09:12:37 2012] [error] [client 103.23.136.12] PHP Warning:  feof() expects parameter 1 to be resource, boolean given in /home/uniteadpro/www/kama/stats/unitead_chart/bar_chart_ratio_recepteur_emetteur.php on line 89
  </code></pre>
  
  <p>And </p>
  
  <pre><code>[Thu Dec 27 09:12:37 2012] [error] [client 103.23.136.12] PHP Warning:  fgets() expects parameter 1 to be resource, boolean given in /home/uniteadpro/www/kama/stats/unitead_chart/bar_chart_ratio_recepteur_emetteur.php on line 90, referer: http://www.unitead.pro/kama/stats/unitead_chart/
  </code></pre>
  
  <p>In log files.<br>
  I do not know how to fix this.</p>