[英]phpseclib new NET_SSH2 does not work
i want to use the phpseclib in my project. 我想在我的项目中使用phpseclib。 If I test it in a single way, it works all fine.
如果我以单一方式对其进行测试,则一切正常。 But when i put it in my sourcecode the sreen is blank.
但是,当我将其放在源代码中时,屏幕是空白的。
Here is the part of the code: 这是代码的一部分:
<?php
namespace data;
spl_autoload_extensions('.php');
spl_autoload_register();
session_start();
//set_include_path(get_include_path() . PATH_SEPARATOR . 'phpseclib');
require '/phpseclib/Net/SSH2.php';
$ssh = new Net_SSH2('localhost'); // this will not work?
?>
I work with namespace. 我使用名称空间。 When i load SSH2.php with require it works all fine.
当我用要求加载SSH2.php时,一切正常。 But at the point i open it with
$ssh = new Net_SSH2('localhost');
但是在这一点上,我用
$ssh = new Net_SSH2('localhost');
打开了它$ssh = new Net_SSH2('localhost');
the code crashed and the screen is blank. 代码崩溃,屏幕空白。
Currently i got the following error: 目前我得到以下错误:
Fatal error: Uncaught exception 'LogicException' with message 'Class Math_BigInteger could not be loaded' in /var/www/test/phpseclib/Net/SSH2.php:857 Stack trace: #0 [internal function]: spl_autoload('Math_BigInteger') #1 /var/www/test/phpseclib/Net/SSH2.php(857): class_exists('Math_BigInteger') #2 /var/www/test/index.php(15): Net_SSH2->Net_SSH2('localhost') #3 {main} thrown in /var/www/test/phpseclib/Net/SSH2.php on line 857
致命错误:/var/www/test/phpseclib/Net/SSH2.php:857堆栈跟踪:#0 [内部函数]:spl_autoload('Math_BigInteger('Math_BigInteger'),未捕获的异常'LogicException',消息为'类Math_BigInteger无法加载' )#1 /var/www/test/phpseclib/Net/SSH2.php(857):class_exists('Math_BigInteger')#2 /var/www/test/index.php(15):Net_SSH2-> Net_SSH2('localhost ')#3 {main}在第857行的/var/www/test/phpseclib/Net/SSH2.php中抛出
This is the actually code: 这是实际的代码:
namespace data;
error_reporting(E_ALL);
ini_set("display_errors", 1);
spl_autoload_extensions('.php');
spl_autoload_register();
session_start();
set_include_path(get_include_path() . PATH_SEPARATOR . 'phpseclib');
require 'phpseclib/Net/SSH2.php';
$ssh = new \Net_SSH2('localhost');
The screen is probably blank because you have display_errors set to 1. If you do ini_set('display_errors', 1);
屏幕可能是空白的,因为您已将display_errors设置为1。如果执行
ini_set('display_errors', 1);
at the top of your PHP file you'll probably start seeing errors. 在PHP文件的顶部,您可能会开始看到错误。
In lieu of knowing what errors you're getting I'd wager to guess that you need to do \\Net_SSH2
instead of Net_SSH2
. 代替知道什么错误,我
\\Net_SSH2
猜测您需要执行\\Net_SSH2
而不是Net_SSH2
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.