I have a PHP script moving a file using function rename, which partly fails. Calling rename gives a "Permission denied" warning. The file seems to have been copied to the target directory (I see it there all right), but it is still present in the source directory after rename.
file_exists confirms that the old file is still present.
unlink can then successfully delete the file – it returns true and file_exists confirms that the file is gone now.
The file comes from being uploaded in an HTTP request into /tmp directory (and I'm using is_uploaded_file to satisfy security considerations – this is not the issue here). The file does have rw permissions for the webservice user (www-data). move_uploaded_file works without errors, too.
The destination directory is in a mounted CIFS directory.
Linux Ubuntu, PHP version 7.2.24.