title: Call R Script from PHP on Linux server
body: <p>I have R installed on my Linux server - typing &quot;R&quot; on the terminal confirms it is installed.</p>
  <p>Now, I'm trying to run a simple R Script from PHP.
  These are the two files I'm testing - both on the same directory:</p>
  <p><code>PHP</code>:</p>
  <pre><code>&lt;?php
   echo exec(&quot;RScript io.R&quot;);
  ?&gt;
  </code></pre>
  <p><code>io.R</code>:</p>
  <pre><code>print(&quot;io&quot;)
  </code></pre>
  <p>Opening the php file on a browser I get an empty page. Also, no error is logged.</p>
  <h2>Edit 1</h2>
  <p>I've replaced <code>exec()</code> by <code>system()</code>, so PHP file now looks like:</p>
  <pre><code>&lt;?php
   echo system(&quot;RScript io.R&quot;);
  ?&gt;
  </code></pre>
  <p>But the result is still a blank page.</p>
  <h2>Edit 2</h2>
  <p>I've replaced <code>exec()</code> by <code>passthru()</code>, so PHP file now looks like:</p>
  <pre><code>&lt;?php
   echo passthru(&quot;RScript io.R&quot;);
  ?&gt;
  </code></pre>
  <p>But the result is still a blank page.</p>