2009-08-28 33 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腳本中的文件名,將該文件放在您知道可以寫入的地方,看看是否可以解決您的問題。