Hi,

I have installed R on my server and have a problem with Rscript. basically when i use Rscript via terminal its working but the same exact code via php doesnt work.

on terminal:

Rscript file.R > file.csv

WORKS!

on php:

shell_exec("Rscript file.R > five.csv");

DOESNT work...

tried:

shell_exec("Rscript file.R 2>&1");

and shows:

Rscript: command not found

located Rscript directory at /usr/bin/Rscript

so i changed the code to:

shell_exec("/usr/bin/Rscript file.R 2>&1");

and got:

sh: usr/bin/Rscript: No such file or directory

made various variations to code thinking either i needed to make sure path to file is correct. tried both absolute and relative paths. nothing worked.

any ideas? please help me. THANKS