ssh2_send_signal
(PECL ssh2 >= 1.5.0)
Send a signal to a remote process
Description
Sends a signal to the process running at the remote end of the given channel.
This function is only available when the extension is built against libssh2 >= 1.9.0.
Parameters
channelAn SSH channel stream, as returned by
ssh2_exec()orssh2_shell().signalThe name of the signal to send, without the
SIGprefix, as defined by the SSH connection protocol (RFC 4254); for exampleTERM,KILLorINT.The value is forwarded to the server as is; it is not validated against the names listed by the protocol.
Return Values
Success
Errors/Exceptions
An E_WARNING is emitted when channel is not an SSH channel stream, and when the signal could not be sent.
Examples
Interrupting a remote command
<?php
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');
$stream = ssh2_exec($connection, 'trap "echo interrupted" INT; sleep 60');
ssh2_send_signal($stream, 'INT');
stream_set_blocking($stream, true);
echo stream_get_contents($stream);
?>