phpdebianphpseclibmod-fcgidfcgid

Phpseclib timeout for read()


I'm using https://github.com/phpseclib/phpseclib to execute cmd's on a Debian server.

echo $ssh->exec("ls");

is working fine for me - but if i try the following (like here) a timeout appears:

$ssh->write("ls -la\n");

echo $ssh->read();

Error log say:

[warn] mod_fcgid: read data timeout in 10 seconds 
[error] Premature end of script headers: index.php

i also tried to increase fcgid settings (up to 300s):

FcgidBusyTimeout 10
FcgidIOTimeout 10

Doesn't works ... any help?

Thanks!


Solution

  • You normally need to do $ssh->read('[prompt]') where [prompt] is a placeholder for the actual prompt. If you don't know the prompt or need to figure it out you can do $ssh->setTimeout(3) before the $ssh->read().