Hi Experts,
I'm building a server in which I want to use R (statistics program) to generate graphs based on user input.
I have an R script which creates a graph and saves it as jpeg, now I want to run it on my server (localhost for now, I'm testing).
Thus I want to create a jpeg (called test.jpeg below) in my /var/www/html/test/ folder which is then displayed on a webpage.
In general this is what I want to do;
<?php
if(isset($_POST['analyses'])){
$command='R CMD BATCH testscript.r';
system($command);
echo '<img src="test.jpeg" width="458" height="458" alt="pic" />';
}
?>
However of course the jpeg cant be written to /var/www/html/test/ without root privileges.
After conducting some web searches I found this recommendation - I should put the bash command:
echo "PASSWORD" | sudo -u root -S COMMAND
in the php system function.
However PCLOS does not use sudo. Now I could setup a sudoers list but I'd rather stick to the philosophy of PCLOS.
Does anybody have any tips on how I can solve this?
Your time is greatly appreciated,