This question is an exact duplicate of:
I am trying to use the Remote ssh functionality in laravel. I keep receiving a "Maximum execution time of 60 seconds exceeded" I understand I can set this timeout, but the problem is it should not be taking that long to do an ls
.
I am able to run the following
exec("ssh -i /path/to/key user@host ls", $out, $code);
without an issue, so this is not a problem with firewall.
but I am unable to run this:
SSH::run(array(
'ls'
), function($line) {
echo $line . PHP_EOL;
});
I am not sure why this is hanging and timing out.
I would also like to know if there is a way to specify ssh -o
options, because for some I may need to specify StrictHostKeyChecking=no
</div>
I have solved this, it turns out my openssl library version and header version did not match, this causes phpseclib(the way laravel connects) to use a slower library, which then causes the timeout. as a temporary fix I have modified the following.
starting at line 256
from this :
switch (true) {
case !isset($versions['Header']):
case !isset($versions['Library']):
case $versions['Header'] == $versions['Library']:
define('MATH_BIGINTEGER_OPENSSL_ENABLED', true);
break;
default:
define('MATH_BIGINTEGER_OPENSSL_DISABLE', true);
}
to this:
switch (true) {
case !isset($versions['Header']):
case !isset($versions['Library']):
case $versions['Header'] == $versions['Library']:
define('MATH_BIGINTEGER_OPENSSL_ENABLED', true);
break;
default:
define('MATH_BIGINTEGER_OPENSSL_ENABLE', true);
}