file_put_contents(meta/services.json):无法打开流:权限被拒绝 [英] file_put_contents(meta/services.json): failed to open stream: Permission denied

查看:289
本文介绍了file_put_contents(meta/services.json):无法打开流:权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Laravel的新手.我试图打开http://localhost/test/public/,我得到了

I am new to Laravel. I was trying to open http://localhost/test/public/ and I got

异常处理程序中的错误.

Error in exception handler.

我搜索了一下,并使用chmod -R 777 app/storage更改了存储目录的权限,但无济于事.

I googled around and changed the permission of storage directory using chmod -R 777 app/storage but to no avail.

我在app.php中更改了debug=>true并访问了该页面,并在异常处理程序中得到了错误:

I changed debug=>true in app.php and visited the page and got Error in exception handler:

流或文件"/var/www/html/test/app/storage/logs/laravel.log" 无法打开:无法打开流:权限被拒绝 /var/www/html/test/bootstrap/compiled.php:8423

The stream or file "/var/www/html/test/app/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /var/www/html/test/bootstrap/compiled.php:8423

然后,我使用命令chmod -R 644 app/storage更改了存储目录的权限,并且错误在异常处理程序中"错误消失了,并加载了页面.但是在那里,我得到了这个:

Then I changed the permissions of storage directory using the command chmod -R 644 app/storage and the 'Error in exception handler' error was gone and a page is loaded. But in there I am getting this:

file_put_contents(/var/www/html/laravel/app/storage/meta/services.json): 无法打开流:权限被拒绝

file_put_contents(/var/www/html/laravel/app/storage/meta/services.json): failed to open stream: Permission denied

推荐答案

vsmoraes 的建议对我有用:

Laravel> = 5.4

php artisan cache:clear 
chmod -R 777 storage/
composer dump-autoload

Laravel< 5.4

php artisan cache:clear 
chmod -R 777 app/storage 
composer dump-autoload

注意:请勿在任何远程服务器(开发或生产)上执行此操作

当我问这个问题时,这是在虚拟机上运行的本地主机上的一个问题.因此,我认为安装777足够安全,但是,当人们说您应该寻找其他解决方案时,他们是正确的.先尝试775

When I asked this question, this was a problem on my localhost, running in a Virtual Machine. So I thought setting up a 777 was safe enough, however, folks are right when they say you should look for a different solution. Try 775 first

这篇关于file_put_contents(meta/services.json):无法打开流:权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆