2012-07-04 3 views
-5

가능한 중복 : 나는 떠들썩한 파일 스크립트를 생성하고 어떤 디렉토리에 저장 한
Problem executing bash file배쉬 파일는 스크립트 PHP

. 이제 누구나 나를 도울 수 있도록이 bash 스크립트를 실행하는 PHP 스크립트를 만들어야합니다!

+0

더 나은 dupes : http://stackoverflow.com/questions/4168179/allowing-php-to-execute-a-bash-script-with-root-permissions, http://stackoverflow.com/questions/10884390/cant-run-shell-script-in-php – PeeHaa

답변

1

exec을 사용할 수 있습니다.

exec('/path/to/that/bash/file'); 
1

기능 exec는 스크립트를 실행하고 추가 매개 변수를 사용하여 스크립트의 출력을 수집합니다.

$output = ''; 
exec("/path/to/your/bash/script.sh", &$output); 
echo $output;