Can't copy file with php, permission denied

时间秒杀一切 提交于 2019-12-11 10:38:02

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!