You might need to install php-pecl-ssh2.i386.
if you don't, it would show the following message
[kevin@kevin tmp]$ php a.php
PHP Fatal error: Call to undefined function ssh2_connect() in /tmp/a.php on line 7
Fatal error: Call to undefined function ssh2_connect() in /tmp/a.php on line 7
The following the sample code of php with ssh
$password = "t35t";
$source = "/tmp/a.txt";
$dest = "/tmp/a.txt";
$conn = ssh2_connect('192.168.0.113', 22);
ssh2_auth_password($conn, $user, $password);
ssh2_scp_send($conn, $source, $dest);
ssh2_exec($conn, 'exit')
?>
全站熱搜