I wrote within my portable web apps the ability to work in all environments by parsing in the exact command lines per OS:
if (@!copy(actual_path(realpath($fullFileNameWithPath)), actual_path($newFullFileNameWithPath)) {
list($copyKommand, $copyRedirect) = @array_values($ap->getKommandOSArray('copy'));
$msg = exec("$copyKommand \"" . actual_path(realpath($fullFileNameWithPath)) . '" "' . actual_path($newFullFileNameWithPath) . "\" $copyRedirect");
if ($msg) echo $msg;
}
Leaving out the obvious, what this does rudimentarily is that it does the PHP-version of copy() first, resolving symlinks via actual_path() and directory structure via realpath(); if it can't do so, then try again by pulling the specific command formatting for copying via OS and spit out any messages that result in the second and final attempt by copying.
Contact me further for details on actual_path() or the method getKommandOSArray() structure.
Phil