title: How to debug ssh2_sftp_rename?
body: <p>I'm having trouble with ssh2_sftp_rename, or in general with the SSH2/SFTP wrapper.</p>
  
  <p>We have two SFTP servers.  One is a test server, which we've setup by ourself, and one is from a service provider.  On the test server, everything works fine while on the provided SFTP we cannot rename a file via PHP.  Manual renaming via sftp cli works fine.  Our SFTP server uses the protocol version 2.0 and remote software version OpenSSH_6.0p1 Debian-4, while the other one uses protocol version 2.0, remote software version OpenSSH_5.3.  So I'd guess they should act the same.</p>
  
  <p>Here's the smallest code snippet for testing, which doesn't work:</p>
  
  <pre><code>&lt;?php
  $connection = ssh2_connect('sftp.serviceprovider.com', 22);
  ssh2_auth_password($connection, 'username', 'password');
  
  $sftp = ssh2_sftp($connection);
  $result = ssh2_sftp_rename($sftp, '/new/foo.xml.gz', '/processed/foo.xml.gz');
  
  var_dump($result);
  var_dump(error_get_last());
  </code></pre>
  
  <p><code>$result</code> is <code>false</code> and <code>error_get_last()</code> returns <code>NULL</code>.  I also tried leaving the beginning slashes or any other combination I can think of, but it just "didn't work": the file is still in the 'new' folder.</p>
  
  <p>So, unfortunately I cannot take a look into the log files of the service provider but I have requested an log excerpt or at least an analysis.  But I don't want to wait for their support center to answer my question and try to debug this stuff.</p>
  
  <p>Is there any possibility to debug what <code>ssh2_sftp_rename</code> or <code>rename</code>are doing behind the scenes?  Does anyone else experienced something like this and found a solution?</p>
  
  <p>Thanks for any hints,
    Matthias</p>