SSH2 ssh2_exec

(PECL ssh2 >= 0.9.0)

ssh2_exec — 원격 서버에서 명령 실행


설명

ssh2_exec(
    resource $session,
    string $command,
    string $pty = ?,
    array $env = ?,
    int $width = 80,
    int $height = 25,
    int $width_height_type = SSH2_TERM_UNIT_CHARS
): resource|false
                

원격 끝에서 명령을 실행하고 이에 대한 채널을 할당합니다.


매개변수

session
ssh2_connect()호출에서 얻은 SSH 연결 링크 식별자입니다.
command
pty
env
env는 대상 환경에서 설정할 이름/값 쌍의 연관 배열로 전달될 수 있습니다.
width
가상 터미널의 너비입니다.
height
가상 터미널의 높이입니다.
width_height_type
width_height_typeSSH2_TERM_UNIT_CHARS 또는 SSH2_TERM_UNIT_PIXELS 중 하나여야 합니다.

반환 값

성공하면 스트림을 반환하고 실패하면 false를 반환합니다.


Examples

예제 #1 명령 실행

                  
<?php
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');

$stream = ssh2_exec($connection, '/usr/local/bin/php -i');
?>
                  
                

기타