问题
I'm trying to copy an uploaded file through php to a folder in the home directory. I gave every permission to the Apache user (www-data) but when I'm trying to copy it I get a warning "failed to open stream: Permission denied".
copy("$target_file", "/home/pap-x/meshes/Part_A.dae");
What's wrong?
回答1:
In addition to www-data having permissions to the directory of $target, it must have at least execute permissions to every directory above the target. If any of those directories deny access then www-data will not be able to find the target directory.
来源:https://stackoverflow.com/questions/35151531/cant-copy-file-with-php-permission-denied