Page 1 of 1

copy() - no worky

Posted: Mon Jan 01, 2007 7:56 pm
by aybra
My code -

Code: Select all

$Afile = "index.php";
$newfile = "index.php.bak";
if (!copy($Afile, $newfile)) {
   echo "failed to copy $Afile...<br>";
}
echo '',$Afile,' - ',$newfile,'';
My problem -

This code works just fine on my localhost - but i upload to my server and it just errors out.

My PHPinfo()

Is it a problem with the code - or a problem with the server?

Posted: Mon Jan 01, 2007 8:06 pm
by hawleyjr
Check out chmod() to modify your directory permissions.

Posted: Mon Jan 01, 2007 8:09 pm
by aybra
I thought about that - the folder is 755 - and so are the files in question.

Posted: Mon Jan 01, 2007 8:11 pm
by hawleyjr
What errors are you getting?

Posted: Mon Jan 01, 2007 8:32 pm
by aybra
Warning: copy(index.php.bak) [function.copy]: failed to open stream: Permission denied in /home/sackettc/public_html/gallery/move.php on line 16
But i cant figure out why i'm getting a permissions error. I've gone over all directories clear up to root - and i'm 775 the whole way up.. i even set this script to run 4775...

This makes no sence to me.

Posted: Mon Jan 01, 2007 8:44 pm
by feyd
So the user executing php is the owner or in the group of the directory?

Posted: Mon Jan 01, 2007 8:49 pm
by aybra
in short.. yes.

The script is running under the owner and group of the directory...

I guess it just has to be something with the configuration of the server.. i should prolly put on my sperluncing gear and try to figure out where the permission set is.