1

I have connected the R and PHP in my local machine but i not able to do it in remote server

My php code is:

 exec("Rscript exec_r.R $final_json_name",$opt_age_json1);
 $str = $opt_age_json1[0];
 $myobj = json_decode($str);
 $final_r_filename = $myobj->first_name;

and My R code is :

 library(jsonlite)
 library(rjson)
 args <- commandArgs(TRUE)
 tmp <- strsplit(args, " ")
 N <- args[1]
 filename<-as.character(N)
 file<-filename
 mydf <- list(first_name = name)
 cat(toJSON(mydf))

It works fine in my local machine but not in live server, in above code what am doing is,send the json file from php to R and process the file in R and send the json result to php

I am not included the full code here , if you help me to return the file name its fine for me.Can any body help me ? Thanks in advance.

elan
  • 11
  • 2
  • hi all i need it urgently , can any body help me please – elan Sep 23 '16 at 10:24
  • "not working in live server." not working how exactly? There could be a hundred reasons. You need to list the error(s) you are getting. – ADyson Sep 23 '16 at 10:37
  • "can't list the errors". According to http://php.net/manual/en/function.exec.php if you supply an extra output parameter it'll give you the return code of the command, which might help – ADyson Sep 23 '16 at 10:46

0 Answers0