首页 > 代码库 > php登陆ssh执行命令

php登陆ssh执行命令

<?php

$connection=ssh2_connect(‘172.16.10.3‘,22);
ssh2_auth_password($connection,$user,$pass);
$cmd="/data/script/start.sh knowledgelib_fix_2";
$ssh2_exec($connection,$cmd);

?>
前提是php要安装ssh.so扩展.

php登陆ssh执行命令