I am trying to execute command using php . when I pass command into proc_open function directly it can be executed fine like this
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("pipe", "w")
);
$cwd = '/temp/';
$env = null;
$blocking = false;
echo $process = proc_open("rrdtool graph 4Rw6S0spak2zoPw9.png DEF:LOAD=/var/www/html/rrd/10.10.0.144/fortigate_cpu.rrd:LOAD:AVERAGE DEF:LOAD_max=/var/www/html/rrd/10.10.0.144/fortigate_cpu.rrd:LOAD:MAX DEF:LOAD_min=/var/www/html/rrd/10.10.0.144/fortigate_cpu.rrd:LOAD:MIN AREA:LOAD#9999cc: AREA:LOAD_max#9999cc: COMMENT:'% CPU Now Ave Max
' LINE1.25:LOAD#0000cc:' ' GPRINT:LOAD:LAST:%6.2lf%s GPRINT:LOAD:AVERAGE:%6.2lf%s GPRINT:LOAD_max:MAX:%6.2lf%s\
COMMENT:
HRULE:0#555555 --title='CPU' ", $descriptorspec, $pipe, $cwd,$env);
the above code is working fine and command executed without any error , but when I passing command through variable it didn't executed . this is the code when I passing command as variable
$cmd="rrdtool graph 4Rw6S0spak2zoPw9.png DEF:LOAD=/var/www/html/rrd/10.10.0.144/fortigate_cpu.rrd:LOAD:AVERAGE DEF:LOAD_max=/var/www/html/rrd/10.10.0.144/fortigate_cpu.rrd:LOAD:MAX DEF:LOAD_min=/var/www/html/rrd/10.10.0.144/fortigate_cpu.rrd:LOAD:MIN AREA:LOAD#9999cc: AREA:LOAD_max#9999cc: COMMENT:'% CPU Now Ave Max
' LINE1.25:LOAD#0000cc:' ' GPRINT:LOAD:LAST:%6.2lf%s GPRINT:LOAD:AVERAGE:%6.2lf%s GPRINT:LOAD_max:MAX:%6.2lf%s\
COMMENT:
HRULE:0#555555 --title='CPU' "
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("pipe", "w")
);
$cwd = '/temp/';
$env = null;
$blocking = false;
echo $process = proc_open($cmd, $descriptorspec, $pipe, $cwd,$env);
this code returned only the number of process but there is no file created