本文介绍了使用 PHP SSH 连接到远程服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用 php 与远程服务器建立 SSH 连接.
I want to make a SSH connection to a remote server using php.
我在 Linux/CEntOS 上使用 php 5.3.
Im using php 5.3 on Linux/CEntOS.
到目前为止我所做的:
$connection = ssh2_connect('192.168.1.22', 22);
ssh2_auth_password($connection, '_username', '_password');
$stream = ssh2_exec($connection, 'ls -l');
但我收到此错误:
致命错误:调用未定义的函数 ssh2_connect()
所以,我的问题是:
php默认没有安装
ssh2_*
函数吗?
我是否需要扩展或库来使用这些函数?
Do I need an extension or library for using these functions?
我该如何解决这个问题?
How can I solve this problem ?