Hello,
I have a PHP script that executes a TCL script . The TCL script creates a file , but when I execute through PHP (from browser) , tcl is not able to create a file.
Can anyone guide me .
//PHP code
<?php
$app = 'tclsh84';
$descriptorspec = array(
0 => array("pipe","r"),
1 => array("file","C:/wamp/www/tcl/bin/out.txt","w"),
2 => array("file","C:/wamp/www/tcl/bin/error.txt","w")
) ;
$process = proc_open($app, $descriptorspec, $pipes);
if (is_resource($process))
{
fwrite($pipes[0], 'source c:/wamp/www/tcl/bin/show.tcl'."\n");
fwrite($pipes[0], ' status 124 mithun '."\n");
fclose($pipes[0]);
proc_close($process);
}
?>
//TCL code
proc status {id uname} {
set x 1
set outfile [open "report.txt" w]
while {$x < 30} {
set systemTime [clock seconds]
puts $outfile "The time is: [clock format $systemTime -format %H:%M:%S] "
puts $outfile "$id $uname "
set x [expr {$x + 1}]
}
close $outfile
}
Thef file report.txt is not created .