title: PHP excel reader cannot read excel file from command prompt
body: <p>I have an application that need to read excel file. I have already done this using a plugin excel-file-reader from <a href="http://code.google.com/p/php-excel-reader/downloads/list" rel="nofollow">http://code.google.com/p/php-excel-reader/downloads/list</a>.
  Now i need my application to read an excel file in a background process, and i choose to run the php file from windows command prompt.but when i do this, the result in command prompt is The filename person2.xls is not readable, but when i run the php file from the browser, it can read the excel file. here is my code to help you understand what i mean.</p>
  
  <pre><code>&lt;?php
  require_once 'php-excel-reader\excel_reader2.php';
  $db=pg_connect('host=localhost dbname=hris user=postgres password=Abcd1234');
  $table='lin_people';
  $dataExcel = new Spreadsheet_Excel_Reader('person2.xls');
  $baris = $dataExcel-&gt;rowcount($sheet_index=0);
  $model=$table;
  $fieldsArray=pg_query('SELECT column_name FROM information_schema.columns WHERE table_name="'.$model.'"');
  //$fieldsArray=Set::extract('/0/'.$model,$fieldsArray);
  $fieldNames=array_keys($fieldsArray[0][$model]);
  $tanda=false;
  for($batas=0;$batas&lt;count($fieldNames);$batas++)
  {
      if($fieldNames[$batas]!='id')
      {
          if($tanda==false)
          {
              $fields[$batas]=$fieldNames[$batas];
          }
          else
          {
              if($batas!=count($fieldNames)-1)
              {
                  $fields[$batas]=$fieldNames[$batas+1];
              }   
          }
      }
      else
      if($fieldNames[$batas]=='id')
      {
          $fields[$batas]=$fieldNames[$batas+1];
          $tanda=true;
      }
  }
  
  $sukses = 0;
  $gagal = 0;
  
  for($i=2;$i&lt;=$baris;$i++)
  {
      if(!empty($dataExcel))
      {
          $this-&gt;$model-&gt;create();
          for($y=0;$y&lt;count($fields);$y++)
          {
              if($y==0)
              {
                  pg_query('INSERT INTO '.$model.' ('.$fields[$y].') VALUES("'.$dataExcel-&gt;val($i,$y+1).'")');
              }
              else
              {
                  $currID=pg_query('SELECT id FROM '.$model.' ORDER BY id desc LIMIT 1');
                  pg_query('INSERT INTO '.$model.' ('.$fields[$y].') VALUES("'.$dataExcel-&gt;val($i,$y+1).'") WHERE id='.$currID);
              }
                              //$this-&gt;$model-&gt;set($fields[$y],$dataExcel-&gt;val($i,$y+1));
          }
      }
                      //$this-&gt;$model-&gt;save();
      if('dataExcel')
      {
          $sukses++;
      }
      else
      {
          $gagal++;
      }
  
  }
  </code></pre>
  
  <p>?> </p>
  
  <p>How can i made this php file read an excel file when I run the php file from command prompt?please help me...</p>