本文介绍了Laravel 5'..无法打开流:连接到本地主机时权限被拒绝'异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

已经设置了一个项目,当尝试连接到本地主机时,我在控制台中收到此错误:

Have set up a project and when trying to connect to the local host I get this error in the console:

我已经按照其他人的指示递归调用了问题文件夹中的chmod 777(即使实践不佳),但还是没有运气.

I have followed other's instructions to recursively call chmod 777 on the problem folder (even though it is bad practise) and still no luck.

这似乎是一个相当普遍的问题,但我找不到任何有用的东西.

It seems to be a fairly common problem but I can't find anything of much use.

推荐答案

简短版本:除了文件夹需要写权限之外,您还需要对文件本身具有写权限.

Short version: In addition to the folder needing write permission, you'll need write permission on the file itself.

/CT/storage/logs/laravel.log

尝试

chmod 777 storage/logs/laravel.log

长版:Unix权限已经并且将继续困扰PHP开发人员,直到时间结束.

Long Version: Unix permissions have, and will continue to plague, PHP developers until the end of time.

问题在于,这里没有简单的正确"答案.您需要的权限取决于您运行网络服务器的方式(mod_php与fastcgi),当前用户帐户是什么,这些帐户之间的关系(它们所在的组)以及日志文件最初是创建的.如果首先通过从命令行运行PHP创建了日志文件,则该文件将归您所有.如果您是首先通过网络浏览器运行PHP创建的,则该文件将归网络服务器用户所有.

The problem is there's no simple "right" answer here. What your permissions need to be will depend on how you're running your web-server (mod_php vs. fastcgi), what your current user account is, how those accounts relate (what group they're in), and how the log file was initially created. If you first created the log file by running PHP from the command line, the file will be owned by you. If you first created it by running PHP from the web browser, the file will be owned by the web server user.

祝你好运!

这篇关于Laravel 5'..无法打开流:连接到本地主机时权限被拒绝'异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 01:35