简体   繁体   English

777我的整个应用程序出现“无法打开流:权限被拒绝”

[英]“failed to open stream: Permission denied” after 777 my entire app

I'm growing several grey hairs trying to work this one out. 我正在种几根白发,试图解决这一问题。

All of a sudden in my Laravel project, I can't upload any files to my symlinked public/storage directly as it's complaining about permissions. 在我的Laravel项目中,突然之间,由于抱怨权限,我无法将任何文件直接上传到我的符号链接的公共/存储中。

I then 777'ed every single file in the app (I know, I know), and it's still complaining about permissions. 然后,我对应用程序中的每个文件进行777处理(我知道,我知道),但它仍然在抱怨权限。 I've also run composer dump-autoload , which never seems to do anything but I thought I'd give it a go anyway. 我还运行过composer dump-autoload ,它似乎从未做过任何事情,但我认为我还是会尝试一下。

Does anyone know what else I can try? 有谁知道我还能尝试什么? I can verify everything is 777, so I can't see why any permissions would fail... 我可以确认所有内容都是777,所以我看不到为什么任何权限都会失败...

Gah, sorry guys, this was a bit of a red herring. Gah,对不起,这有点像鲱鱼。

777'ing everything wasn't working because the uploaded files were being set to 644 (so my manual 777 was only being applied to files that already existed) 777不能正常工作,因为上传的文件被设置为644(所以我的手册777仅适用于已经存在的文件)

For future reference, if anyone's using Laravel and a queued job can't access a 644 file, set the file to 664 immediately after upload ( apache owns the uploaded file, but www-data (or ec2-user ) is the one trying to access when queued). 供以后参考,如果任何人正在使用Laravel并且排队的作业无法访问644文件,请在上传后立即将文件设置为664( apache拥有上传的文件,但是www-data (或ec2-user )是尝试使用的文件)排队时访问)。

SE Linux might be a possible culprit, because the policies change in some cases, eg. SE Linux可能是罪魁祸首,因为在某些情况下,例如,政策会发生变化。 when there are broken modules, it will mess up. 当有损坏的模块时,它将陷入混乱。 that would be setsebool -P httpd_read_user_content 1 (if this should throw an error, manually deleting the broken modules is the only thing that helps). 可能是setsebool -P httpd_read_user_content 1 (如果这会引发错误,那么手动删除损坏的模块是唯一setsebool -P httpd_read_user_content 1 )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM