phpseclib SSH2挂起在Math_BigInteger :: modPow()

时间:2014-05-12 10:41:10

标签: php phpseclib

我已经尝试过SSH2的基本示例,但它会挂起。

<?php
ini_set('display_errors', 1);

include('Net/SSH2.php');
$host = '192.168.100.101';
$ssh = new Net_SSH2($host);

如果我设置了时间限制,例如1000秒:

<?php
ini_set('display_errors', 1);
set_time_limit(1000);

include('Net/SSH2.php');
$host = '192.168.100.101';
$ssh = new Net_SSH2($host);

我会得到:

Fatal error: Maximum execution time of 1000 seconds exceeded in /path/to/Math/BigInteger.php on line 1060
Stack trace:
#  Time      Memory  Function                           Location
1  0.0014    647704  {main}( )                          ../index.php:0
2  0.0219    2203280 Net_SSH2->Net_SSH2( )              ../index.php:14
3  0.1114    4439056 Net_SSH2->_key_exchange( )         ../SSH2.php:952
4  0.1837    4520224 Math_BigInteger->modPow( )         ../SSH2.php:1309
5  0.1840    4521888 Math_BigInteger->_slidingWindow( ) ../BigInteger.php:1723
6  0.1842    4523144 Math_BigInteger->_prepareReduce( ) ../BigInteger.php:1817
7  0.1842    4523144 Math_BigInteger->_reduce( )        ../BigInteger.php:1912
8  0.1842    4523144 Math_BigInteger->_barrett( )       ../BigInteger.php:1876
9  0.1844    4536024 Math_BigInteger->divide( )         ../BigInteger.php:2032
10 1001.4549 4577384 Math_BigInteger->subtract( )       ../BigInteger.php:1497
11 1001.4549 4586584 Math_BigInteger->_subtract( )      ../BigInteger.php:991

有没有人知道是什么造成的?

提前致谢。

更多信息: 我在Linux x86_64上使用PHP 5.3.28作为Apache 2.2.10的模块。

1 个答案:

答案 0 :(得分:0)

您正在使用最慢的phpseclib模式,因此无法提供帮助。但是,那说......

试试最新的git版本。特别是,这个提交应该会导致轻微的加速:

https://github.com/phpseclib/phpseclib/commit/e4ff01f05475e81a56681ebfdb5473a07099e5ea

相关问题