exec 명령어 함수의 프로토타입은 다음과 같습니다.
참고로 하시기 바랍니다.
그리고 될 수 있으면, system(), passthru() 등의 함수를 이용하는 것이 좋은 방법입니다.
exec -- Execute an external program
Description
string exec(string command, string [array], int [return_var]);
exec() executes the given command, however it does not output anything. It simply returns the last line from the result of the command. If you need to execute a command and have all the data from the command passed directly back without any interference, use the PassThru() function.
If the array argument is present, then the specified array will be filled with every line of output from the command. Note that if the array already contains some elements, exec() will append to the end of the array. If you do not want the function to append elements, call unset() on the array before passing it to exec().
If the return_var argument is present along with the array argument, then the return status of the executed command will be written to this variable.
Note that if you are going to allow data coming from user input to be passed to this function, then you should be using EscapeShellCmd() to make sure that users cannot trick the system into executing arbitrary commands.
See also system(), PassThru(), popen() and EscapeShellCmd().
> 안녕하세요.
> 며칠전 mysql과 php3를 설치하고 적수게시판을 설치하려고 했습니다.
> 그런데 설치하기 전에 test하는 과정에서 system에서 exec() 함수의 실행
> 여부를 체크해 보니 작동하지 않는걸로 나오는군요.
> 그냥 일반적인 설치방법으로는 작동이 안하는 겁니까?
> 만약 그렇다면 어떻게 해야 하나요?
> 초보입니다. 좀 자세하게 설명 부탁드립니다.
>
> 참고로 제 서버에는
> Apache 1.3.12
> PHP3 3.0.15
> MySQL 3.21.33c
> 입니다.
>
> 아래글은 test.php 파일의 소스입니다.
>
> <? php
>
> echo("exec() 함수 테스트<p><br>") ;
> exec("echo \exec함수가 정상 작동 합니다", $test) ;
>
> echo $test[0] ;
>
> ?>
>
>
> 감사합니다.
|