我在telnet/ssh上使用Unix,网络上有几个模块和DB。当来自特定模块的特定用户尝试连接时,我需要我的PHP层来连接到它们中的任何一个…
有没有一种方法可以通用地连接到UNIX?
发布于 2011-10-07 10:47:58
发布于 2017-05-19 20:26:39
下面是使用PHP语言进行连接的方法:
<?php
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');
$stream = ssh2_exec($connection, '/usr/local/bin/php -i');
?>
// $connection is the SSH connection link identifier, obtained from a call to ssh2_connect().
https://stackoverflow.com/questions/7686029
复制相似问题