phpseclib exceeded max execution time

ぐ巨炮叔叔 提交于 2019-12-02 06:58:40

问题


I am currently using laravel(which uses phpseclib) for my project and was having issues with the ssh connection, getting the error Maximum execution time of 60 seconds exceeded now I know this value can be extended but I should not have to in order to run a simple ls command.

it seems to be failing in this class phpseclib/Math/BigInteger.php

I have tried every example in the phpseclib documentation, I am still getting the same errors.

I have also tried using exec("ssh -i /path/to/key user@host ls", $out, $code); and I am able to connect just fine.

I have also testing fsock and no errors returned, so everything looks good.

  $fsock = fsockopen('server', 22);
  echo fgets($fsock, 1024);

any ideas on why this is happening?


回答1:


I have solved this, it turns out my openssl library version and header version did not match, this causes phpseclib to use a slower library, which then causes the timeout. as a temporary fix I have modified the following.

here:

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);
        }


来源:https://stackoverflow.com/questions/23765220/phpseclib-exceeded-max-execution-time

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!