phpseclib 超出最大执行时间 [英] phpseclib exceeded max execution time

查看:50
本文介绍了phpseclib 超出最大执行时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在为我的项目使用 laravel(它使用 phpseclib)并且在 ssh 连接时遇到问题,出现错误 最大执行时间超过 60 秒 现在我知道这个值可以扩展但我不应该为了运行一个简单的 ls 命令.

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.

这门课似乎失败了phpseclib/Math/BigInteger.php

我已经尝试了 phpseclib 文档 中的每个示例,我仍然得到相同的结果错误.

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

我也尝试过使用 exec("ssh -i/path/to/key user@host ls", $out, $code); 并且 我只能连接很好.

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

我也测试了 fsock 并且没有返回错误,所以一切看起来都很好.

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?

推荐答案

我已经解决了这个问题,结果我的openssl库版本和头文件版本不匹配,这导致phpseclib使用了一个较慢的库,从而导致超时.作为临时修复,我修改了以下内容.

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.

此处:

从第 256 行开始

从此:

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

为此:

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

这篇关于phpseclib 超出最大执行时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆