Note that this WILL NOT WORK if trying to rename a directory to a network share.
e.g.
rename('/home/user/me/dir1', '/mnt/shares/nfsmount/dir2')
will create a file called 'dir2' on the share and not a directory.
This caught me out and my (quickest) solution was to use an exec and mv command:
<?php
$cmd = 'mv "/home/user/me/dir1" "/mnt/shares/nfsmount/dir2"';
exec($cmd, $output, $return_val);
if ($return_val == 0) {
echo "success";
} else {
echo "failed";
}
?>