ok i will mention this before i post a script that works.. 99% of the time your problem will lie in permission problem ;o) so make sure you have the right permissions before copying!! and if you must have 777 (r/w/x) world-wide, make sure you have it away from any sensitive data!
now, for the script:
<?php
$source = "/home/kdavis/www/images/users/blah/old-file.php";
$dest = "/home/kdavis/www/images/users/blah/new-file.php";
// you must make sure $source and $dest have proper permissions
if ( copy($source, $dest) ) {
chmod($source,0777); // let's give it permissions for the heck of it
echo "successfully copied.";
} else {
echo "unsuccessfully coped.";
}
?>
hope this helps,
kyle