title: Opening multiple html files in PhantomJs via PHP throws syntax error
body: <p>I want my php script to call phantomjs from command line, which will generate muliple pdf's out of many html files. So I have a concatenated string with paths to my html files, and next I invoke <code>exec</code> command :</p>
  
  <pre><code>$myFile1 = dirname(__FILE__)."/testFile0.html";
  $myFile2 = dirname(__FILE__)."/testFile1.html";
  $myFile3 = dirname(__FILE__)."/testFile2.html";
  
  $files = array($myFile1, $myFile2, $myFile3);
  
  $command = 'phantomjs '.dirname(__FILE__).'/render.js '.implode('|', $files);
  exec($command, $phantomOut);
  
  echo print_r($phantomOut); 
  </code></pre>
  
  <p>When I'm calling 'phantomjs render.js "file1.html|file2.html"' everything works fine. But, when trying to do this from the php script I'm getting the following error in apache error_log:  </p>
  
  <pre><code>testFile1.html: line 1: syntax error near unexpected token `&lt;'  
  testFile1.html: line 1: `&lt;!DOCTYPE HTML...
  </code></pre>
  
  <p>The HTML files I'm using look fine, so I'm out of ideas on what can cause this. The output when running this script in the browser is : <code>Array ( ) 1</code> instead of the text I'm getting in the command line.</p>
  
  <p>Below is the PhantomJs rendering script :</p>
  
  <pre><code>var page = require('webpage').create(),
      addresses = phantom.args[0],
      outputPath = '/path_to_pdf/',
      outputFilename,
      filesArray, outputArray = [],
      loadInProgress = false,
      pageIndex = 0, 
      interval;
  
  page.viewportSize = { width: 600, height: 600};
  
  if(addresses.indexOf('|') !== -1){
      filesArray = addresses.split('|');
  } else{
      filesArray = [addresses];
  }
  
  interval = setInterval(function() {
      if (!loadInProgress &amp;&amp; pageIndex &lt; filesArray.length) {
          page.open(filesArray[pageIndex]);
      }
      if (pageIndex === filesArray.length) {
          console.log('OUTPUT: ', outputArray.join('|'));
          phantom.exit();
      }
  }, 250);
  
  page.onLoadStarted = function() {
      loadInProgress = true;
  };
  
  page.onLoadFinished = function() {
      loadInProgress = false;
      outputFilename = 'print'+pageIndex+'.pdf';
      page.render(outputPath+outputFilename);
      outputArray.push(outputFilename);
      pageIndex++;
  }
  </code></pre>