我已经在我的CentOS7盒子里克隆了一个幼体回收物.当我试图运行它时,我得到一个500错误,没有显示任何内容.

So I check out /var/log/httpd/error_log and I see that I've got some permissions errors:

[Mon May 16 11:39:32.996441 2016] [:error] [pid 2434] [client 104.156.67.195:39136] PHP Fatal error:  Uncaught UnexpectedValueException: The stream or file "/var/www/html/MYSITE/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /var/www/html/MYSITE/bootstrap/cache/compiled.php:13701
Stack trace:
#0 /var/www/html/MYSITE/bootstrap/cache/compiled.php(13635): Monolog\\Handler\\StreamHandler->write(Array)
#1 /var/www/html/MYSITE/bootstrap/cache/compiled.php(13396): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)
#2 /var/www/html/MYSITE/bootstrap/cache/compiled.php(13494): Monolog\\Logger->addRecord(400, Object(Symfony\\Component\\Debug\\Exception\\FatalErrorException), Array)
#3 /var/www/html/MYSITE/bootstrap/cache/compiled.php(13189): Monolog\\Logger->error(Object(Symfony\\Component\\Debug\\Exception\\FatalErrorException), Array)
#4 /var/www/html/MYSITE/bootstrap/cache/compiled.php(13160): Illuminate\\Log\\Writer->writeLog('error', Object(Symfony\\Component\\Debug\\Exception\\FatalErrorException), Array)
# in /var/www/html/MYSITE/bootstrap/cache/compiled.php on line 13701

I have done the following to try to overcome the issues:

chmod -R 775 storage
chmod -R 775 vendor
chown -R apache:apache storage

So it now shows as so:

-rwxrwxr-x. 1 apache apache 2156 May 16 11:41 storage/logs/laravel.log

但那没用.

足够有趣的是,我之前错误键入了大约artisan个命令,这些命令似乎会将日志(log)添加到日志(log)文件中……

I already read/tried:

推荐答案

Turns out the issue is with selinux

I found this answer, which solved my problem.

使用以下命令关闭selinux,以证明这就是问题所在

setenforce 0

This should allow writing, but you've turned off added security server-wide. That's bad. Turn SELinux back

setenforce 1

然后最后使用SELinux允许通过使用

chcon -R -t httpd_sys_rw_content_t storage

你走了!

Laravel相关问答推荐

子目录中具有Vue实例的Laravel不起作用

Laravel本地化错误:"setlocale():参数#1($category)的类型必须是int,给定的是Illuminate\Http\Request"

vagrant会损坏你的电脑. | macOS v12(蒙特雷)#13132

无法使用 Dompdf Laravel 9 加载图像

FileViewFinder.php 第 137 行中的 Laravel 5 InvalidArgumentException:未找到视图 [.admin]

Laravel 错误ReflectionException-类 App\Http\Kernel 不存在

Laravel PHP 框架的新手. /以外的路由不起作用

判断 Laravel 模型表中是否存在列,然后应用条件

Laravel 5.5 类型错误:传递给 Illuminate\Auth\EloquentUserProvider::validateCredentials() 的参数 1 必须是实例

Laravel 从现有模型生成迁移

中间件中的 Laravel 依赖注入

Laravel 应用程序中应用程序键的意义是什么?

Laravel 全部返回 ID 变为 0

扩展 Eloquent 的类的构造函数

Laravel 5.3 通知 - 仅使用Electron邮件地址通知

Guzzle 返回流空体而不是 json 体

Laravel 5 new auth:获取当前用户以及如何实现角色?

在 laravel Passport 客户端应用程序中使用访问令牌获取用户数据

php artisan migrate - SQLSTATE [HY000] [1045] 用户'laravel'@'localhost'的访问被拒绝

Laravel 数据迁移