intval($sftp) " " intval($sftp) ssh2_disconnect(). SFTP- SSH2- unset($sftp) $sftp = null. :
if (!$ssh2_connection = ssh2_connect($host, $port)) {
die("Failed to connect\n");
}
if (!ssh2_auth_password($ssh2_connection, $username, $password)) {
die("Failed to login\n");
}
if (!$sftp_connection = ssh2_sftp($ssh2_connection)) {
die("Failed to open SFTP session\n");
}
if (!$fh = fopen("ssh2.sftp://".intval($sftp_connection).$path, 'r')) {
die("Failed to open file\n");
}
while (($s = fgets($fh)) !== false) {
echo $s;
}
fclose($fh);
unset($sftp_connection);
if (!ssh2_disconnect($ssh2_connection)) {
die("Failed to disconnect\n");
}
PS " " - :
php: channel.c: 2570: _libssh2_channel_free: "" .
.