我最近迁移了 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/目录和子目录当前拥有权限:755
谁能帮我解决一下。如果您还需要了解其他信息,请评论。
提前致谢。
最佳答案
只需在我的 Linux 命令行中输入命令:
sudo chmod -R 777 /home/username/public/website.com/public/x_images/
关于php - Imagick、Fopen、PHP 和权限的服务器迁移问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25684250/