Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/249.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php中的ssh2_exec不工作_Php_Linux_Ssh_Centos - Fatal编程技术网

php中的ssh2_exec不工作

php中的ssh2_exec不工作,php,linux,ssh,centos,Php,Linux,Ssh,Centos,我正在尝试用php向远程服务器(aerohive)发送exec命令。但是exec命令什么也不做 我已经安装了我的ssh2扩展,授权也工作正常 代码如下: if (!function_exists("ssh2_connect")) die("function ssh2_connect doesn't exist"); if (!($con = ssh2_connect("myipadresherenotshowingtoyouguys", 22))) {

我正在尝试用php向远程服务器(aerohive)发送exec命令。但是exec命令什么也不做

我已经安装了我的ssh2扩展,授权也工作正常

代码如下:

        if (!function_exists("ssh2_connect"))
        die("function ssh2_connect doesn't exist");

    if (!($con = ssh2_connect("myipadresherenotshowingtoyouguys", 22))) {
        echo "fail: unable to establish connection\n";
    } else {
        // try to authenticate with username root, password secretpassword
        if (!ssh2_auth_password($con, "blablabla", "blablabla!")) {
            echo "fail: unable to authenticate\n";
        } else {
            // allright, we're in!
            echo "okay: logged in...\n";

            // execute a command
            $command = 'ssid "Wentzo test2" hide-ssid';
            if (!($stream = ssh2_exec($con, $command))) {
                echo "fail: unable to execute command\n";
            } else {

                $stream2 = ssh2_exec($con, $command_save);
                // collect returning data from command
                stream_set_blocking($stream, true);
                $data = "";
                while ($buf = fread($stream, 4096)) {
                    $data .= $buf;
                }

                fclose($stream);
            }
        }
    }

检查php.ini文件,如果它确实禁用了函数
禁用函数

能否打开错误报告并向我们显示错误消息?没有给出错误!:(