imagejpeg() 权限问题

发布于 2024-11-18 04:12:00 字数 557 浏览 4 评论 0原文

我正在尝试使用 gd 库创建缩略图,并使用 imagejpeg() 函数。然后输出显示以下错误

警告:imagejpeg() [function.imagejpeg]:无法打开 '/var/www/html/yahoo/thumbs/1136.jpg' 用于写入:权限被拒绝 /var/www/html/yahoo/Thumbnail.php 上 第56行

我已在拇指文件夹上设置了完整的 777 权限,是否还有其他原因可能导致此问题,或者我在这里遗漏了某些内容。

谢谢:)

我尝试使用 fopen 创建文件,但遇到了同样的问题。fopen 返回以下警告:

Warning: fopen(/var/www/html/yahoo/thumbs/1176.jpg) [function.fopen]: failed to open stream: Permission denied in /var/www/html/yahoo/Thumbnail.php on line 56 can't open file

Im trying to create thumbnails using gd library and am using the imagejpeg() function. The output then shows the following error

Warning: imagejpeg()
[function.imagejpeg]: Unable to open
'/var/www/html/yahoo/thumbs/1136.jpg'
for writing: Permission denied in
/var/www/html/yahoo/Thumbnail.php on
line 56

I have set full 777 permissions on the thumbs folder, is there something else that could be causing this, or am i missing something here.

thanks :)

Ive tried creating the file with fopen and am getting the same issue.. fopen returns the following warning:

Warning: fopen(/var/www/html/yahoo/thumbs/1176.jpg) [function.fopen]: failed to open stream: Permission denied in /var/www/html/yahoo/Thumbnail.php on line 56 can't open file

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

魔法少女 2024-11-25 04:12:00

SELinux 正在阻止 HTTPd 写入该目录。使用 chcon 将 /var/www/html/yahoo/thumbs/ 的文件上下文更改为 httpd_sys_rw_content_t ,如果可以的话,那么使用semanage使其永久化。

SELinux is preventing HTTPd from writing into that directory. Use chcon to change the file context of /var/www/html/yahoo/thumbs/ to httpd_sys_rw_content_t, and if that lets it work then use semanage to make it permanent.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文