复制文件permmissons后复制失败

I tried to to the following:

Copy files and folder from folder .../myfolder/subfolder etc. to folder .../anotherfolder/subfolder etc.

Copy this works fine.

The Folder has permissions 0755 and, if I copy that, the new folder has the same permissions.

So I want to change the permission to 0644, I tried to do that with

if(!chmod($path, 0644)){ die("Error"); } 

it failed with the message

chmod(): Permission denied

my path is relative, the same as I used to copy.

I don't understand why it doesn't work.

Thank for helping and explain