I am trying to execute the following simple R script via PHP but I am always getting exit code 1 if I put library() function call.
library('optparse')
quit()
The PHP script 'test.php' is given as:
<?php
$calc = exec("Rscript test.r", $R_output, $R_exitcode);
print $calc_routine;
The script produces exit code 0 when I remove library() function call, so it's sure that R script is located correctly.