I tried $sftp->chmod('0755', "file.zip"); and $sftp->chmod('0755', "file.zip"); But in both cases the permission has been set to 363 instead
+1
A:
At a guess the permissions are 1363. In other words octal(755). It's a complete guess, but I would suggest that the chmod function is taking a decimal mode, rather than an octal one.
Douglas Leeder
2009-11-27 14:23:13
A look through the file at http://www.frostjedi.com/terra/SFTP.txt tells me it is indeed binary. +1
Gausie
2009-11-27 14:32:50
A:
0755 and '0755' are not the same thing as demonstrated thusly:
<?php echo '0755' == 0755 ? 'equal' : 'not equal'; ?>
Per that, try removing the single quotes around 0755.
The reason phpseclib expects permissions to be represented as an octal value ('0755' is cast to a decimal value - not an octal one) is because that's how ftp_chmod does it and that's what Net_SFTP::chmod() is modeled after. (actually, pretty much all of phpseclib's SFTP API is modeled after PHP's FTP extension API)
terrafrost
2009-11-27 17:16:58