问题
Im trying to use this, but it just gives me this errors and i have no clue how to fix that..
Warning: include_once(Math/BigInteger.php): failed to open stream: No such file or directory in /home/www/sfs_web/statistics/_public/_functions/Server/Net/SSH2.php on line 891
Warning: include_once(): Failed opening 'Math/BigInteger.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/www/sfs_web/statistics/_public/_functions/Server/Net/SSH2.php on line 891
Warning: include_once(Crypt/Random.php): failed to open stream: No such file or directory in /home/www/sfs_web/statistics/_public/_functions/Server/Net/SSH2.php on line 895
Warning: include_once(): Failed opening 'Crypt/Random.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/www/sfs_web/statistics/_public/_functions/Server/Net/SSH2.php on line 895
Warning: include_once(Crypt/Hash.php): failed to open stream: No such file or directory in /home/www/sfs_web/statistics/_public/_functions/Server/Net/SSH2.php on line 899
Warning: include_once(): Failed opening 'Crypt/Hash.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/www/sfs_web/statistics/_public/_functions/Server/Net/SSH2.php on line 899
Warning: include_once(Crypt/Base.php): failed to open stream: No such file or directory in /home/www/sfs_web/statistics/_public/_functions/Server/Net/SSH2.php on line 904
Warning: include_once(): Failed opening 'Crypt/Base.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/www/sfs_web/statistics/_public/_functions/Server/Net/SSH2.php on line 904
Fatal error: Call to undefined function phpseclib_resolve_include_path() in /home/www/sfs_web/statistics/_public/_functions/Server/Net/SSH2.php on line 1226
include('Net/SSH2.php');
$ssh = new Net_SSH2('host');
if (!$ssh->login('user', 'pass')) {
echo('Login Failed');
}
$ssh->exec('the cmd line...");
$ssh->disconnect();
回答1:
phpseclib is probably not in your include_path. Quoting phpseclib.sourceforge.net,
<?php
set_include_path(get_include_path() . PATH_SEPARATOR . 'phpseclib');
include('Net/SSH2.php');
?>
You'll need to adjust that as appropriate. If phpseclib is in the vendor/phpseclib directory then do 'vendor/phpseclib'
instead, etc.
回答2:
Yep, you need set_include_path. And, in my way I've replace in ssh2.php all include directive
include_once(Math/BigInteger.php)
on
stream_resolve_include_path(Math/*****.php)
来源:https://stackoverflow.com/questions/32762655/phpseclib-gives-me-a-strange-erros