0

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 
 }

fファイルreport.txtは作成されません。

4

1 に答える 1

2

TCLコードを見ると、report.txtというファイルを作成しようとしていますが、ディレクトリ構造のどこに作成されているかを指定していません。したがって、Webサーバーがホームディレクトリとして設定したディレクトリにファイルを作成しようとしていると思います。

TCLスクリプトのファイル名を変更して、書き込み可能な場所にファイルを配置し、これで問題が解決するかどうかを確認します。

于 2009-08-28T13:55:43.623 に答える