Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/05/2005, 15:49
Avatar de Galled
Galled
 
Fecha de Ingreso: marzo-2005
Ubicación: Lima
Mensajes: 254
Antigüedad: 19 años, 1 mes
Puntos: 0
Failed to open stream

Me aparece este error:

Warning: file(tmp/b0fmweuzwf.Rout): failed to open stream: No such file or directory in /usr/local/apache2/htdocs/siscpa/ArchivosPHP/doR.php on line 146


Mi codigo es:

Código PHP:
<?
require "security.php";
 
$R_path "//aguaje/siscpa/ArchivosPHP/R/rw2001/bin/Rterm.exe";
<?
function 
random_str($size

        
$randoms = array( 
                
0123456789ab
                
cdefghijklmn
                
opqrstuvwxy
        
); 

        
srand ((double) microtime() * 1000000); 

        for(
$i 1$i <= $size$i++) 
            
$text .= $randoms[(rand(0,35))]; 

        return 
$text


function 
get_file_name($text)
{
  
$temp1 explode("file=\"",$text);
  
$fname explode("\"",$temp1[1]);

  return 
$fname[0];
}

if (!
$r_code || $r_code == "")
{
  echo 
"<font color=red>No se ha ingresado ningun codigo!</font><p>";
  echo 
"</TD></TR></TABLE></BODY></HTML>";
  exit;
}

$old_code explode(chr(10),$r_code);
$total count($old_code);
$new_code "";

for (
$i=0;$i $total$i++)
{
  
$j $i+1;
  
$old $old_code[$i];

  
check_bad($old,$j);

  if (
ereg("$graphic",$old_code[$i]))
  {
     
$gfile_name get_file_name($old_code[$i]);
     
$gfile_name random_str(4).$gfile_name;
     
     
$new_code .= $graphic."(file=\"$temp_dir/$gfile_name\") \n";
  }
  else
     
$new_code .= $old_code[$i]."\n";
}

$r_name random_str(10);
$r_input $temp_dir."/".$r_name.".R";
$r_output $temp_dir."/".$r_name.".Rout";

$fp fopen($r_input,"w");
fwrite($fp,$new_code);
fclose($fp);

$rsoft $R_path;

$command "$rsoft $R_options_1 $r_input $R_options_2 $r_output";
$exec_result exec($command$result ,$error);

$lines file($r_output);
$total count($lines);

if (
$error)
{
  echo 
"<font color=red>Error: Algo sucedio mal! Por favor revise la salida!</font>";
  echo 
"<HR>Salida del programa R : <P><HR>";

  for (
$i=0;$i $total;$i++)
    echo 
$lines[$i]."<BR>";

  exit;
}

echo 
"Salida del programa R¡G<P><HR>";

$to_do_plot 0;

for (
$i=0;$i $total;$i++)
{
  
$line $lines[$i];
  if (
ereg("$graphic",$line))
  {
    echo 
$line."<BR>";

    
$gfile_name get_file_name($line);
    
$to_do_plot 1;

  }
  else if (
ereg("dev.off",$line))
  {
    echo 
$line."<BR>";

    if (
$to_do_plot == 1)
    { 
      echo 
"<P><IMG SRC=\"$gfile_name\"><P>";
      
$to_do_plot 0;
    }
  }
  else if (
ereg("null device",$line))
    continue;
  else if (
ereg("          1",$line))
    continue;
  else
    echo 
$line."<BR>";
}

?>
</TD><TR></TABLE>
</BODY>
</HTML>
La linea 146 es

$lines = file($r_output);