在PHP上通过系统调用复制文件失败


Copying files via system call fails on PHP

我试图将一些文件从服务器上的一个目录复制到另一个目录,但它不起作用。

这是我的代码:

system('cp /var/www/site1/images/' . $row['imageUrl']. ' /var/www/site2/content/upload/content/item/mid/' . $row['imageUrl']);
$file = '/var/www/site1/images/'.$row['imageUpl'];
$newfile = '/var/www/site2/content/upload/content/item/mid/'.$row['imageUpl'];
if (copy($file, $newfile)) {
    echo "success";
}
else
{
    echo "failed";
}

查看此处的copy()函数:http://php.net/manual/ru/function.copy.php