It's possible the server is using keyboard-interactive authentication and not password authentication.
Really, libssh2 doesn't provide any good way for one to know that. My recommendation: try phpseclib, a pure PHP SSH2 implementation. eg.
<?php
include('Net/SSH2.php');
define('NET_SSH2_LOGGING', NET_SSH2_LOG_COMPLEX);
$ssh = new Net_SSH2('www.domain.tld');
if (!$ssh->login('username', 'password')) {
echo $ssh->getLog();
exit('Login Failed');
}
echo $ssh->exec('pwd');
echo $ssh->exec('ls -la');
?>
By default it's $ssh->login()
method will try password authentication but (and unlike libssh2) it'll try keyboard-interactive if password auth fails.
And if neither work the code snippet I posted will echo out the logs so you can see what type of input it is expecting. If those logs are posted if you could post them in your response so that people here may diagnose the issue that'd be great.
Thanks!