Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.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和stream_select()错误_Php_Python - Fatal编程技术网

PHP-ssh2_exec和stream_select()错误

PHP-ssh2_exec和stream_select()错误,php,python,Php,Python,当我尝试使用ssh2\u exec在远程服务器上运行python脚本,并尝试使其在非阻塞模式下运行时。出现一个错误: stream_select():无法将SSH2通道类型的流表示为 select()可编辑描述符 我的代码: $ssh_connection = ssh2_connect('server ip address',22); ssh2_auth_password($ssh_connection, 'root', 'password'); $stream = ssh2_exec($ss

当我尝试使用
ssh2\u exec
在远程服务器上运行python脚本,并尝试使其在非阻塞模式下运行时。出现一个错误:

stream_select():无法将SSH2通道类型的流表示为 select()可编辑描述符

我的代码:

$ssh_connection = ssh2_connect('server ip address',22);
ssh2_auth_password($ssh_connection, 'root', 'password');

$stream = ssh2_exec($ssh_connection, 'cd /opt/; python db.py'); 

stream_set_blocking($stream, false);

$read = array($stream);
$write = array();
$except = array();

$return_string = stream_get_contents($stream); 

//echo $return_string;

stream_select($read, $write, $except, 300);

有人知道为什么它会显示这个错误吗?

看起来你是在远程服务器上没有访问权限或被禁止。尝试从另一个IP运行