-3

my phpseclib-1.0 was working fine yesterday, but then all of a sudden my script is flagging this error;

PHP Warning:  include_once(Math/BigInteger.php): failed to open stream: No such file or directory in /home/Net/SSH2.php on line 943
PHP Warning:  include_once(): Failed opening 'Math/BigInteger.php' for inclusion (include_path='.:/usr/share/php') in /home/Net/SSH2.php on line 943
PHP Warning:  include_once(Crypt/Random.php): failed to open stream: No such file or directory in /home/Net/SSH2.php on line 947
PHP Warning:  include_once(): Failed opening 'Crypt/Random.php' for inclusion (include_path='.:/usr/share/php') in /home/Net/SSH2.php on line 947
PHP Warning:  include_once(Crypt/Hash.php): failed to open stream: No such file or directory in /home/Net/SSH2.php on line 951
PHP Warning:  include_once(): Failed opening 'Crypt/Hash.php' for inclusion (include_path='.:/usr/share/php') in /home/Net/SSH2.php on line 951
PHP Warning:  include_once(Crypt/Base.php): failed to open stream: No such file or directory in /home/Net/SSH2.php on line 956
PHP Warning:  include_once(): Failed opening 'Crypt/Base.php' for inclusion (include_path='.:/usr/share/php') in /home/Net/SSH2.php on line 956
PHP Fatal error:  Uncaught Error: Call to undefined function phpseclib_resolve_include_path() in /home/Net/SSH2.php:1363

I have not changed the script since it last ran perfectly ... how can this be?

EDIT: I changed the filepaths in the main Net/SSH2.php thinking that was the issue, and now I get this error;

PHP Notice:  No compatible server to client encryption algorithms found in /home/Net/SSH2.php on line 1561

Thanks

NRav
  • 407
  • 1
  • 6
  • 18
  • Something will always work until it doesn't. The files or directories aren't there anymore. We can't help you with that. If you did any updates or restarts in the meantime, that can help us trying to solve the root of the problem. – Loek Jul 10 '18 at 12:08
  • @Loek agreed. I have not done any restarts or updates – NRav Jul 10 '18 at 12:10
  • Does the folder `/home/Net` even exist? Is there a user named `Net`? Are the `access permissions` of the folder(s) set properly? Did you run it as a different user maybe? – Mario Werner Jul 10 '18 at 12:14
  • @MarioWerner the folder exists, nothing has changed since it ran last time ... what `access permissions` are necessary? they have been seemingly unchanged as well – NRav Jul 10 '18 at 12:20
  • @MarioWerner minor update, when I run it in a screen, it works, but that doesnt make sense... its the same script ran by the same user – NRav Jul 10 '18 at 12:44

1 Answers1

0

It looks like you're using phpseclib 1.0 instead of 2.0. phpseclib 2.0 relies on autoloading to take care of a lot of this.

To get phpseclib 1.0 to work you probably need to set the include_path:

set_include_path(get_include_path() . PATH_SEPARATOR . 'libraries/phpseclib');

libraries/phpseclib would need to be adjusted to where-ever you're phpseclib install lives.

Also, undo all the changes you did to the include's. idk what changes you made but those are liable to break any include_path stuff you might do.

neubert
  • 15,947
  • 24
  • 120
  • 212
  • thanks, i will try that. How easy is it to to transition to phpseclib 2.0 on a linux ubuntu 16.04 box? – NRav Jul 10 '18 at 13:19
  • @NicholasRavanelli - phpseclib 2.0 is best installed with Composer. As for API changes to it... quoting phpseclib.sourceforge.net, "_The 2.0 branch has pretty much the exact same API as the 1.0 branch, save for that it is namespaced, uses PHP5-style constructors (thereby avoiding E_DEPRECATED errors) and requires the use of an autoloader_". http://phpseclib.sourceforge.net/2.0.html kinda provides an example of how you'd do it altho if you install phpseclib with Composer I do `require __DIR__ . '/vendor/autoload.php';` instead of `$loader->register();` – neubert Jul 10 '18 at 13:22