PHP를 통해 실행되는 tcl을 사용하여 파일을 만들 수 없습니다.
문제
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 file report.txt가 생성되지 않았습니다.
해결책
TCL 코드를 살펴보면 report.txt라는 파일을 작성하려고하지만 디렉토리 구조의 위치가 생성되는 위치를 지정하지 않습니다. 따라서 웹 서버가 홈 디렉토리로 설정 한 디렉토리의 파일을 만들려고 할 것이라고 생각합니다.
TCL 스크립트의 파일 이름을 변경하여 파일을 작성할 수있는 곳에 넣고 문제가 해결되는지 확인하십시오.
제휴하지 않습니다 StackOverflow