php中进行ssh登陆不能使用简单的exec命令,需要对php进行ssh2的扩展。

下面介绍简单的php-ssh环境配置。

1.安装扩展包

apt-get install libssh2-1-dev libssh2-php

2.检查是否配置成功

php -m |grep ssh2

如果返回 ssh2 则说明配置成功

3重启server服务

service apache2 restart


下一篇具体介绍php怎么进行ssh连接