I am trying to connect to ftp with the following code in php
$connection = ssh2_connect($host, $port);
ssh2_auth_password($connection, $user, $password);
$sftp = ssh2_sftp($connection);
However, instead of triggering an error, the script just hangs. When I try connecting via the linux command line, I get the error
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: <login date> from <my ip>
Could not chdir to home directory /xxx/xxx/./xxx/xxxx/xxx: No such file or directory
Connection to <my ip> closed.
How do I get the script to trigger an error (preferably something more specific about what happened) instead of hanging?