title: Running R script from php webpage
body: <p>I am trying to build a php file that allows users to run a R script so they don't need to open a session in the server, just to open a browser. </p>
  
  <p>Usual bash from the script run fine (say echo "something", copy and move data files,...) but R script is not running. R is called with Rscript</p>
  
  <pre><code>Rscript --no-save --no-restore --verbose ./RAMS-mapa-onades-zones-manual.R &gt; outputFile.Rout 2&gt;&amp;1
  </code></pre>
  
  <p>R output gives this error</p>
  
  <pre><code>running
    '/usr/lib/R/bin/R --slave --no-restore --no-save --no-restore'
  
  Error in library("rgdal") : there is no package called 'rgdal'
  Execution halted
  </code></pre>
  
  <p>Well, library(rgdal) is the first line of the R script. Rgdal is present on the R installation and the script runs fine (Rscript myscript.R) from the command line.</p>
  
  <p>As starting from php, the user running R is www-data while on the terminal the user is meteo. It seems to me that some environment variable needs to be set in the php Rscript execution but I can't find the way to do it.</p>
  
  <p>Any idea? Thanks in advance</p>