compatible with R version 3.4.4 (2018-03-15)?
Hello, thanks for you nice and useful work!
I have installed R version 3.4.4 (2018-03-15) on Ubuntu 16.04.5 LTS. I have installed your class trough composer and upgrade it to the dev-master version.
I then run a basic php script: `ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);
require 'vendor/autoload.php';
use Kachkaev\PHPR\RCore; use Kachkaev\PHPR\Engine\CommandLineREngine;
$args = array(); $args['pathToErrorFile'] = '/home/marco/logs/errors.txt';
$prog = new CommandLineREngine('/usr/bin/R', $args); $r = new RCore($prog);
echo $r->run('exp(1)');`
but the page enter in a infinite loop when I try to make the run function. no log file is created.
I have also tried to run the following code with the same result:
$rProcess = $r->createInteractiveProcess(); $rProcess->start(); $rProcess->write('x = 100'); $rProcess->write('x * x'); echo $rProcess->getAllResult();
if I run R as apache (sudo -u www-data /usr/bin/R) I am able to run correctly all the comands on R
thank-you Marco
Hi @marco86to, sorry to hear this! I believe that the issue is to do with I/O between PHP and R and unfortunately I don't know how to fix it. A similar problem was reported recently by @dipenpatel235 in https://github.com/kachkaev/php-r/issues/41.
Could you please help me with investigating? I'll be happy to accept a PR with the fix!
Hi @kachkaev, thanks for your fast reply. I have done some tests and just comment the following while circle on https://github.com/kachkaev/php-r/blob/master/src/Kachkaev/PHPR/Process/CommandLineRProcess.php:
// Skip the startup message (if any) do { $out = fread($this->pipes[1], $this->infiniteLength); usleep($this->sleepTimeBetweenReads); } while ($out !== '> ' && substr($out, -3) !== "\n> ");
if I comment that everything is working well thanks Marco