我最近迁移了linux服务器。
我目前在尝试使用Imagick从表单上传图像时遇到了这个错误。
Warning: fopen(/home/user/public/website.com/public/images/users/current/thumb/username.jpg): failed to open stream: Permission denied in /home/user/public/website.com/public/inc/functions/functions.php on line 864
运行的代码驻留在一个函数中:
try{
$im = new Imagick($image['tmp_name']);
if($im_w != 'O' && $im_h != 'O'){
$im->cropThumbnailImage($im_w,$im_h);
}
$fp = fopen($path, 'w'); //the line that is causing the error to occur. line 864.
$im->writeImageFile($fp);
return 1;
}
catch(Exception $e)
{
echo $e->getMessage();
}
我已经查看了各种PHP/Linux权限修复程序,/images/directory和子目录当前具有权限:755
有人能帮我解决问题吗。如果您需要了解其他信息,请发表评论。
提前谢谢。
只需在我的linux命令行中输入命令:
sudo chmod -R 777 /home/username/public/website.com/public/x_images/