title: php exec() run Rscript successfully by cmd line but not working by browser
body: <p>I am trying to write a web app to run my R script.
  I plan to use php shell_exec() to make this happen. </p>
  
  <p>I wrote a test script like this 
  <code>&lt;?php echo shell_exec("Rscript /var/www/html/demo/MyRScript.R"); ?&gt;</code></p>
  
  <p>I run it through command line.
  <code>php test.php</code>, it gives right output, I also observe through <code>htop</code> and found the process was using 100% cpu for couple of minutes.</p>
  
  <p>However, when I tried to run it through visiting it through browser, through the address <code>http://myURL/demo/test.php</code>. It didn't run properly, it only gives first few line of my R script <code>onbrief Off On FALSE 405 0 TRUE 0 405 petitioner P R FALSE 0 396 TRUE 414 0</code>and stopped immediately. I cannot find that process through <code>htop</code> either.</p>
  
  <p>I have tried other simple command line like <code>ls</code>, <code>rm</code>, they all work properly both on cmd line and through web app. </p>
  
  <p>I have no idea what is wrong. Can it because the process takes too much CPU, so some mechanism will terminate it if it is call by web?</p>
  
  <p>Or if there is any debug tool or method I can use to help me find the problem.</p>
  
  <p>This is my first question on Stack overflow, I don't know if my information is enough. please tell me if there is other more information needed to tackle the problem.</p>
  
  <p>Thank you so much.</p>