Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have centos 6.5 installed on a vps. For some reason the php copy operation fails when the target is a sub-directory. I have change the folders mod to 755 and the owner is apache but no luck. Copy works on the same directory. Where can the problem be. Below is the php code:

$file = 'test.txt';
$newfile = './upload/test.txt.bak';
if (!copy($file, $newfile)) {
echo "failed to copy $file...\n";    }


share|improve this question

closed as off-topic by Michael Hampton♦ May 26 at 18:17

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must be relevant to professional system administration. Server Fault is dedicated to professional system and network administrators. End user and enthusiast questions are off-topic (contact your system administrator or hire a professional to help you out). Please see the Help Center for more information." – Michael Hampton
If this question can be reworded to fit the rules in the help center, please edit the question.

You actually need to do error checking to find out what the problem is. If you need help with programming, visit our sister site Stack Overflow. –  Michael Hampton May 26 at 18:18