title: wkhtmltopdf failing to convert local pages to PDF
body: <p>I've been trying to get wkhtmltopdf to convert pages on a website and it's failing to convert pages that are on the same. It'll convert and store external pages (tried it with google and bbc.co.uk, both worked) so the permissions are fine but if I try to convert a local page, either a static html file or one generated by a script, it takes around 3 minutes before failing.</p>
  
  <p>The output says the page has failed to load, if forcibly ignore this, I end up with a blank PDF.</p>
  
  <p>I thought it might be session locking but closing the session resulted in the same issue. I feel it's something down to the way the server may be behaving though</p>
  
  <p>Here's the code in question:</p>
  
  <pre><code>            session_write_close ();
      set_time_limit (0);
              ini_set('memory_limit', '1024M');
      Yii::app()-&gt;setTheme("frontend");
  
      // Grabbing the page name
      $ls_url = Yii::app()-&gt;request-&gt;getHostInfo().Yii::app()-&gt;request-&gt;url;
  
      // Let's remove the PDF otherwise we'll be in endless loop
      $ls_url = str_replace('.pdf','',$ls_url);
  
      // Setting paths
      $ls_basePath = Yii::app()-&gt;basePath."/../extras/wkhtmltopdf/";
      if(PHP_OS=="Darwin")
          $ls_binary = $ls_basePath . "wkhtmltopdf-osx";
      else 
          $ls_binary = $ls_basePath . "wkhtmltopdf";
  
      $ls_generatedPagesPath = $ls_basePath . "generated-pages/";
      $ls_outputFileName = str_replace(array("/",":"),"-",$ls_url)."--".date("dmY-His").".pdf";
      $ls_outputFile = $ls_generatedPagesPath. $ls_outputFileName;
  
      // making sure no nasty chars are in place
      $ls_command = escapeshellcmd($ls_binary ." --load-error-handling ignore " . $ls_url . " " . $ls_outputFile);
  
  
      // Let's run things now
      system($ls_command);
  </code></pre>