imagejpeg() 权限问题
我正在尝试使用 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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/
tohttpd_sys_rw_content_t
, and if that lets it work then usesemanage
to make it permanent.