I am getting the following error from Laravel5 upon rendering any page:

我在渲染任何页面时从Laravel5收到以下错误:

ErrorException in Filesystem.php line 74: 
file_put_contents(/fdcc73e2e72031a510ae8f921ce1d22d): failed to open stream: Permission denied

my cache config is as follows:

我的缓存配置如下:

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Default Cache Store
    |--------------------------------------------------------------------------
    |
    | This option controls the default cache connection that gets used while
    | using this caching library. This connection is used when another is
    | not explicitly specified when executing a given caching function.
    |
    */

    'default' => env('CACHE_DRIVER', 'file'),

    /*
    |--------------------------------------------------------------------------
    | Cache Stores
    |--------------------------------------------------------------------------
    |
    | Here you may define all of the cache "stores" for your application as
    | well as their drivers. You may even define multiple stores for the
    | same cache driver to group types of items stored in your caches.
    |
    */

    'stores' => [

        'apc' => [
            'driver' => 'apc'
        ],

        'array' => [
            'driver' => 'array'
        ],

        'database' => [
            'driver' => 'database',
            'table'  => 'cache',
            'connection' => null,
        ],

        'file' => [
            'driver' => 'file',
            'path'   => storage_path().'/framework/cache',
        ],

        'memcached' => [
            'driver'  => 'memcached',
            'servers' => [
                [
                    'host' => '127.0.0.1', 'port' => 11211, 'weight' => 100
                ],
            ],
        ],

        'redis' => [
            'driver' => 'redis',
            'connection' => 'default',
        ],

    ],

    /*
    |--------------------------------------------------------------------------
    | Cache Key Prefix
    |--------------------------------------------------------------------------
    |
    | When utilizing a RAM based store such as APC or Memcached, there might
    | be other applications utilizing the same cache. So, we'll specify a
    | value to get prefixed to all our keys so we can avoid collisions.
    |
    */

    'prefix' => 'laravel',

];

Interestingly enough if I change the default to array or any of the other options it still tries to write the cache file to root folder and fails every time.

有趣的是,如果我将默认值更改为数组或任何其他选项,它仍会尝试将缓存文件写入根文件夹并且每次都失败。

Has anyone else encountered this?

有人遇到过这种情况么?

3 个解决方案

#1


20

See if 'storage/framework/views' exists. If you add it and you still have problems. Make sure it is writeable (775, 77, etc...)

查看是否存在“storage / framework / views”。如果你添加它仍然有问题。确保它是可写的(775,77等......)

In my case, error happened because I deployed to my production server via github, but the contents of storage were not tracked by git. I fixed this by making sure that the .gitignore files in each of the directories inside /storage were committed to the repo.

在我的情况下,错误发生是因为我通过github部署到我的生产服务器,但存储的内容没有被git跟踪。我通过确保/ storage中的每个目录中的.gitignore文件都已提交到repo来修复此问题。

Notes: Usually those weird filenames have something to do with the Blade templates. I don't think it's actually trying to store the cache file in root.

注意:通常这些奇怪的文件名与Blade模板有关。我认为它实际上并没有尝试将缓存文件存储在root中。

My error was similar: "ErrorException in Filesystem.php line 81: file_put_contents(/f946048111f1176619e22f5127724e37): failed to open stream: Permission denied"

我的错误类似:“Filesystem.php第81行中的ErrorException:file_put_contents(/ f946048111f1176619e22f5127724e37):无法打开流:权限被拒绝”

更多相关文章

  1. PHP强大包括处理错误?
  2. 您是否认为PHP中的错误形式是在类方法中访问超级全局变量?
  3. 解析错误:语法错误,第12行/home/public_html/gigs.html中的意外T_L
  4. eclipse 编写php错误
  5. 我无法定义我的错误
  6. php中的错误级别
  7. fgetcsv()错误地将双引号添加到第一行的第一个元素
  8. CakePHP错误:在Acl中找不到类'String'
  9. 如何捕获错误,如无法打开流和连接超时

随机推荐

  1. android 底部菜单
  2. android之【TableLayout布局】
  3. cocos2dx android mac
  4. Android 文件下载 downloadManager
  5. android 作业1相对布局(拼图)
  6. android之实现SeekBar拖动组件
  7. EditText设置不自动弹出键盘
  8. android桌面快捷方式添加 删除 更新 自动
  9. MediaScannerReceiver
  10. 2011.07.18——— android AlphaBitmap