Net_SSH2::getErrors PHP Method

getErrors() public method

Returns all errors
public getErrors ( ) : string
return string
    function getErrors()
    {
        return $this->errors;
    }

Usage Example

function ssh_connect($host)
{
    dbg_log("Connecting over SSH to {$host}");
    #define('NET_SSH2_LOGGING', NET_SSH2_LOG_COMPLEX);
    $ssh = new Net_SSH2($host);
    $key = new Crypt_RSA();
    $key->setPassword(get_config()->host_ssh_private_key_password);
    $keyPath = get_config()->host_ssh_private_key;
    $keyString = file_get_contents($keyPath);
    $userString = get_config()->host_ssh_username;
    if (!$key->loadKey($keyString)) {
        dbg_log(var_dump($ssh->getErrors(), true));
        exit("cannot import key {$keyPath}");
    }
    if (!$ssh->login($userString, $key)) {
        dbg_log($ssh->getLastError());
        exit('Login Failed');
    }
    return $ssh;
}
All Usage Examples Of Net_SSH2::getErrors