<?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);
?>