PHP: move_uploaded_file(): 无法移动 '/

2022-08-30 22:52:34

我在刚刚设置的新服务器上不断收到此错误

[Wed Feb 16 22:46:51 2011] [error] [client 71.1.236.114] PHP Warning:  
move_uploaded_file(upload/110216104651_00134_smooth_1440x900.jpg): 
failed to open stream: Permission denied in /var/www/admin/_application/models/Roles.model on line 1757, 
referer: http://nacc.biz/admin/admin/modifyarticle.php?roleid=4
[Wed Feb 16 22:46:51 2011] [error] [client 71.1.236.114] PHP Warning:  move_uploaded_file():
Unable to move '/tmp/php6wlOg1' to    'upload/110216104651_00134_smooth_1440x900.jpg' 
in /var/www/admin/_application/models/Roles.model on line 1757, referer:
http://nacc.biz/admin/admin/modifyarticle.php?roleid=4
[Wed Feb 16 22:46:51 2011] [error] [client 71.1.236.114] PHP Notice:  
Upload Error: Error moving from temp dir in /var/www/admin/_application/models/Roles.model on line 1759,
referer: http://nacc.biz/admin/admin/modifyarticle.php?roleid=4

我添加了777并创建了一个上传目录,但错误仍然存在。如何找到需要更正或创建的路径?


答案 1

将 所有者 更改为 和 chmod toupload/www-data:www-data755


答案 2

看起来它不知道在哪里。确保语句中有完整路径。例如,如果上载目录实际上位于 中,请确保它位于语句中,而不仅仅是 /。upload//var/uploadupload


推荐