I can successfully transfer files to and from my server using the following code:
$connection = ssh2_connect('hostname', 3222);
ssh2_auth_password($connection, 'username', 'password');
$sftp = ssh2_sftp($connection);
ssh2_scp_send($connection, '/local/directory/bug.gif', '/remote/directory/bug.gif', 0644);
ssh2_scp_recv($connection, '/remote/directory/bug.gif', '/local/directory/bug2.gif');
but when I try to do the same with a second server (have not tried a third) I get
Warning: ssh2_scp_send(): Failure creating remote file in /media/data/srv/www/test/sftp/prototype.php on line 8
Warning: ssh2_scp_recv(): Unable to receive remote file in /media/data/srv/www/test/sftp/prototype.php on line 9
The second server uses port 3222. I can in fact scp into this second server and transfer files via the command line as well as FileZilla and gFTP just fine. I do in fact have read/write permission on the target directory.
What's going on? Please help if possible--it's very urgent.