2009-08-28 68 views
0

我有一个执行TCL脚本的PHP脚本。 TCL脚本创建一个文件,但是当我通过PHP(从浏览器)执行时,tcl无法创建文件。无法使用通过PHP执行的TCL创建文件

任何人都可以指导我。未创建

// PHP代码

<?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代码

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文件REPORT.TXT。

+0

error.txt中有什么? – 2009-08-28 11:25:45

回答

2

看着你的TCL代码,它试图创建一个名为report.txt的文件,但是你没有在目录结构中指定它正在创建的位置。所以我认为它会尝试在Web服务器设置为主目录的任何目录中创建文件。

更改TCL脚本中的文件名,将该文件放在您知道可以写入的地方,看看是否可以解决您的问题。