ssh2_exec
(PECL ssh2 >= 0.9.0)
Execute a command on a remote server
Description
Execute a command at the remote end and allocate a channel for it.
Parameters
sessionAn SSH connection link identifier, obtained from a call to
ssh2_connect().commandptyenvenvmay be passed as an associative array of name/value pairs to set in the target environment.widthWidth of the virtual terminal.
heightHeight of the virtual terminal.
width_height_typewidth_height_typeshould be one ofSSH2_TERM_UNIT_CHARSorSSH2_TERM_UNIT_PIXELS.
Return Values
Returns a stream on successFalseforfailure.
Examples
Executing a command
<?php
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');
$stream = ssh2_exec($connection, '/usr/local/bin/php -i');
?>