Question

I installed phpseclib in my wordpress site. Every time I run the this script, it shows blank page and even it hides wordpress admin bar.

include('Net/SSH2.php');
$ssh = new Net_SSH2('www.domain.tld');

if (!$ssh->login('username', 'password')) 
{
    exit('Login Failed');
}
echo $ssh->exec('pwd');

echo $ssh->exec('ls -la');`

But then I placed the library outside the wordpress and it works perfectly. What could be the problem? I really need the code running inside the wordpress.Thanks in advance!

Was it helpful?

Solution

My guess: phpseclib isn't in the in the include_path in your script. The blank page that you're getting is probably due to a Fatal error stemming from PHP being unable to instantiate the Net_SSH2 class because Net/SSH2.php wasn't included.

If you set display_errors = 1 and error_reporting = E_ALL you'd probably see the error.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top