laravel无法打开缓存

时间:2017-02-04 15:00:56

标签: php laravel-5.3

我正在使用laravel 5.3。我收到一些用户的错误信息。

"<!DOCTYPE html>\n<html>\n    <head>\n        <meta charset=\"UTF-8\" />\n        <meta name=\"robots\" content=\"noindex,nofollow\" />\n    <style>\n            /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */\n            html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}\n\n html { background: #eee; padding: 10px }\n            img { border: 0; }\n            #sf-resetcontent { width:970px; margin:0 auto; }\n      .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 }\n     .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; }\n            .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }\n            .sf-reset .clear_fix { display:inline-block; }\n            .sf-reset * html .clear_fix { height:1%; }\n            .sf-reset .clear_fix { display:block; }\n    .sf-reset, .sf-reset .block { margin: auto }\n            .sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; }\n            .sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }\n            .sf-reset strong { font-weight:bold; }\n            .sf-reset a { color:#6c6159; cursor: default; }\n            .sf-reset a img { border:none; }\n            .sf-reset a:hover { text-decoration:underline; }\n            .sf-reset em { font-style:italic; }\n            .sf-reset h1, .sf-reset h2 { font: 20px Georgia, \"Times New Roman\", Times, serif }\n            .sf-reset .exception_counter { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; float: left; display: block; }\n            .sf-reset .exception_title { margin-left: 3em; margin-bottom: 0.7em; display: block; }\n            .sf-reset .exception_message { margin-left: 3em; display: block; }\n   .sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }\n            .sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;\n               
-webkit-border-bottom-right-radius: 16px;\n                -webkit-border-bottom-left-radius: 16px;\n                -moz-border-radius-bottomright: 16px;\n                -moz-border-radius-bottomleft: 16px;\n                border-bottom-right-radius: 16px;\n                border-bottom-left-radius: 16px;\n                border-bottom:1px solid #ccc;\n                border-right:1px solid #ccc;\n            border-left:1px solid #ccc;\n                word-wrap: break-word;\n  }\n            .sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px;\n               
-webkit-border-top-left-radius: 16px;\n                -webkit-border-top-right-radius: 16px;\n                -moz-border-radius-topleft: 16px;\n                -moz-border-radius-topright: 16px;\n                border-top-left-radius: 16px;\n                border-top-right-radius: 16px;\n                border-top:1px solid
#ccc;\n                border-right:1px solid #ccc;\n                border-left:1px solid #ccc;\n                overflow: hidden;\n       word-wrap: break-word;\n            }\n            .sf-reset a { background:none; color:#868686; text-decoration:none; }\n            .sf-reset a:hover { background:none; color:#313131; text-decoration:underline; }\n            .sf-reset ol { padding: 10px 0; }\n            .sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;\n               
-webkit-border-radius: 10px;\n                -moz-border-radius: 10px;\n                border-radius: 10px;\n                border: 1px solid #ccc;\n            }\n        </style>\n    </head>\n    <body>\n                    <div id=\"sf-resetcontent\" class=\"sf-reset\">\n                <h1>Whoops, looks like something went wrong.</h1>\n                                        <h2 class=\"block_exception clear_fix\">\n                            <span class=\"exception_counter\">1/1</span>\n                         <span class=\"exception_title\"><abbr title=\"ErrorException\">ErrorException</abbr> in <a title=\"/var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php line 111\" ondblclick=\"var f=this.innerHTML;this.innerHTML=this.title;this.title=f;\">Filesystem.php line 111</a>:</span>\n                            <span class=\"exception_message\">file_put_contents(/var/www/html/storage/framework/cache/ee/d4/eed4d8aabbee6202985fb4c3ae0c0cbae5e6a9ae): failed to open stream: No such file or directory</span>\n              </h2>\n                        <div class=\"block\">\n                 <ol class=\"traces list_exception\">\n       <li> in <a title=\"/var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php line 111\" ondblclick=\"var f=this.innerHTML;this.innerHTML=this.title;this.title=f;\">Filesystem.php line 111</a></li>\n       <li>at <abbr title=\"Illuminate\\Foundation\\Bootstrap\\HandleExceptions\">HandleExceptions</abbr>->handleError('2', 'file_put_contents(/var/www/html/storage/framework/cache/ee/d4/eed4d8aabbee6202985fb4c3ae0c0cbae5e6a9ae): failed to open stream: No such file or directory', '/var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php', '111', <em>array</em>('path' => '/var/www/html/storage/framework/cache/ee/d4/eed4d8aabbee6202985fb4c3ae0c0cbae5e6a9ae', 'contents' => '1485962651i:1;', 'lock' => <em>true</em>))</li>\n       <li>at <abbr title=\"\"></abbr>file_put_contents('/var/www/html/storage/framework/cache/ee/d4/eed4d8aabbee6202985fb4c3ae0c0cbae5e6a9ae', '1485962651i:1;', '2') in <a title=\"/var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php line 111\" ondblclick=\"var f=this.innerHTML;this.innerHTML=this.title;this.title=f;\">Filesystem.php line 111</a></li>\n       <li>at <abbr title=\"Illuminate\\Filesystem\\Filesystem\">Filesystem</abbr>->put('/var/www/html/storage/framework/cache/ee/d4/eed4d8aabbee6202985fb4c3ae0c0cbae5e6a9ae', '1485962651i:1;', <em>true</em>) in <a title=\"/var/www/html/vendor/laravel/framework/src/Illuminate/Cache/FileStore.php line 106\" ondblclick=\"var f=this.innerHTML;this.innerHTML=this.title;this.title=f;\">FileStore.php line 106</a></li>\n       <li>at <abbr title=\"Illuminate\\Cache\\FileStore\">FileStore</abbr>->put('8fdbb78c39d0bb8ddf52611ad4b113436f7b3dda', '1485962651i:1;', '1') in <a title=\"/var/www/html/vendor/laravel/framework/src/Illuminate/Cache/Repository.php line 206\" ondblclick=\"var f=this.innerHTML;this.innerHTML=this.title;this.title=f;\">Repository.php line 206</a></li>\n       <li>at <abbr title=\"Illuminate\\Cache\\Repository\">Repository</abbr>->put('8fdbb78c39d0bb8ddf52611ad4b113436f7b3dda', '1', '1') in <a title=\"/var/www/html/vendor/laravel/framework/src/Illuminate/Cache/Repository.php line 253\" ondblclick=\"var f=this.innerHTML;this.innerHTML=this.title;this.title=f;\">Repository.php line 253</a></li>\n       <li>at <abbr title=\"Illuminate\\Cache\\Repository\">Repository</abbr>->add('8fdbb78c39d0bb8ddf52611ad4b113436f7b3dda', '1', '1') in <a title=\"/var/www/html/vendor/laravel/framework/src/Illuminate/Cache/RateLimiter.php line 61\" ondblclick=\"var f=this.innerHTML;this.innerHTML=this.title;this.title=f;\">RateLimiter.php line 61</a></li>\n       <li>at <abbr title=\"Illuminate\\Cache\\RateLimiter\">RateLimiter</abbr>->hit('8fdbb78c39d0bb8ddf52611ad4b113436f7b3dda', '1') in <a title=\"/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php line 46\" ondblclick=\"var f=this.innerHTML;this.innerHTML=this.title;this.title=f;\">ThrottleRequests.php line 46</a></li>\n       <li>at <abbr title=\"Illuminate\\Routing\\Middleware\\ThrottleRequests\">ThrottleRequests</abbr>->handle(<em>object</em>(<abbr title=\"Illuminate\\Http\\Request\">Request</abbr>), <em>object</em>(<abbr title=\"Closure\">Closure</abbr>), '60', '1') in <a title=\"/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php line 137\" ondblclick=\"var f=this.innerHTML;this.innerHTML=this.title;this.title=f;\">Pipeline.php line 137</a></li>\n       <li>at <abbr title=\"Illuminate\\Pipeline\\Pipeline\">Pipeline</abbr>->Illuminate\\Pipeline\\{closure}(<em>object</em>(<abbr title=\"Illuminate\\Http\\Request\">Request</abbr>)) in <a title=\"/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php line 33\" ondblclick=\"var f=this.innerHTML;this.innerHTML=this.title;this.title=f;\">Pipeline.php line 33</a></li>\n       <li>at <abbr title=\"Illuminate\\Routing\\Pipeline\">Pipeline</abbr>->Illuminate\\Routing\\{closure}(<em>object</em>(<abbr title=\"Illuminate\\Http\\Request\">Request</abbr>)) in <a title=\"/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php line 104\" ondblclick=\"var f=this.innerHTML;this.innerHTML=this.title;this.title=f;\">Pipeline.php line 104</a></li>\n       <li>at <abbr title=\"Illuminate\\Pipeline\\Pipeline\">Pipeline</abbr>->then(<em>object</em>(<abbr title=\"Closure\">Closure</abbr>)) in <a title=\"/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php line 644\" ondblclick=\"var f=this.innerHTML;this.innerHTML=this.title;this.title=f;\">Router.php line 644</a></li>\n       <li>at <abbr title=\"Illuminate\\Routing\\Router\">Router</abbr>->runRouteWithinStack(<em>object</em>(<abbr title=\"Illuminate\\Routing\\Route\">Route</abbr>), <em>object</em>(<abbr title=\"Illuminate\\Http\\Request\">Request</abbr>)) in <a title=\"/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php line 618\" ondblclick=\"var f=this.innerHTML;this.innerHTML=this.title;this.title=f;\">Router.php line 618</a></li>\n       <li>at <abbr title=\"Illuminate\\Routing\\Router\">Router</abbr>->dispatchToRoute(<em>object</em>(<abbr title=\"Illuminate\\Http\\Request\">Request</abbr>)) in <a title=\"/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php line 596\" ondblclick=\"var f=this.innerHTML;this.innerHTML=this.title;this.title=f;\">Router.php line 596</a></li>\n       <li>at <abbr title=\"Illuminate\\Routing\\Router\">Router</abbr>->dispatch(<em>object</em>(<abbr title=\"Illuminate\\Http\\Request\">Request</abbr>)) in <a title=\"/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php line 267\" ondblclick=\"var f=this.innerHTML;this.innerHTML=this.title;this.title=f;\">Kernel.php line 267</a></li>\n       <li>at <abbr title=\"Illuminate\\Foundation\\Http\\Kernel\">Kernel</abbr>->Illuminate\\Foundation\\Http\\{closure}(<em>object</em>(<abbr title=\"Illuminate\\Http\\Request\">Request</abbr>)) in <a title=\"/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php line 53\" ondblclick=\"var f=this.innerHTML;this.innerHTML=this.title;this.title=f;\">Pipeline.php line 53</a></li>\n       <li>at <abbr title=\"Illuminate\\Routing\\Pipeline\">Pipeline</abbr>->Illuminate\\Routing\\{closure}(<em>object</em>(<abbr title=\"Illuminate\\Http\\Request\">Request</abbr>)) in <a title=\"/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php line 46\" ondblclick=\"var f=this.innerHTML;this.innerHTML=this.title;this.title=f;\">CheckForMaintenanceMode.php line 46</a></li>\n       <li>at <abbr title=\"Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode\">CheckForMaintenanceMode</abbr>->handle(<em>object</em>(<abbr title=\"Illuminate\\Http\\Request\">Request</abbr>), <em>object</em>(<abbr title=\"Closure\">Closure</abbr>)) in <a title=\"/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php line 137\" ondblclick=\"var f=this.innerHTML;this.innerHTML=this.title;this.title=f;\">Pipeline.php line 137</a></li>\n       <li>at <abbr title=\"Illuminate\\Pipeline\\Pipeline\">Pipeline</abbr>->Illuminate\\Pipeline\\{closure}(<em>object</em>(<abbr title=\"Illuminate\\Http\\Request\">Request</abbr>)) in <a title=\"/var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php line 33\" ondblclick=\"var f=this.innerHTML;this.innerHTML=this.title;this.title=f;\">Pipeline.php line 33</a></li>\n       <li>at <abbr title=\"Illuminate\\Routing\\Pipeline\">Pipeline</abbr>->Illuminate\\Routing\\{closure}(<em>object</em>(<abbr title=\"Illuminate\\Http\\Request\">Request</abbr>)) in <a title=\"/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php line 104\" ondblclick=\"var f=this.innerHTML;this.innerHTML=this.title;this.title=f;\">Pipeline.php line 104</a></li>\n       <li>at <abbr title=\"Illuminate\\Pipeline\\Pipeline\">Pipeline</abbr>->then(<em>object</em>(<abbr title=\"Closure\">Closure</abbr>)) in <a title=\"/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php line 149\" ondblclick=\"var f=this.innerHTML;this.innerHTML=this.title;this.title=f;\">Kernel.php line 149</a></li>\n       <li>at <abbr title=\"Illuminate\\Foundation\\Http\\Kernel\">Kernel</abbr>->sendRequestThroughRouter(<em>object</em>(<abbr title=\"Illuminate\\Http\\Request\">Request</abbr>)) in <a title=\"/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php line 116\" ondblclick=\"var f=this.innerHTML;this.innerHTML=this.title;this.title=f;\">Kernel.php line 116</a></li>\n       <li>at <abbr title=\"Illuminate\\Foundation\\Http\\Kernel\">Kernel</abbr>->handle(<em>object</em>(<abbr title=\"Illuminate\\Http\\Request\">Request</abbr>)) in <a title=\"/var/www/html/public/index.php line 53\" ondblclick=\"var f=this.innerHTML;this.innerHTML=this.title;this.title=f;\">index.php line 53</a></li>\n    </ol>\n</div>\n\n            </div>\n    </body>\n</html>"
<?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.
    |
    | Supported: "apc", "array", "database", "file", "memcached", "redis"
    |
    */

    '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',
            'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
            'sasl'       => [
                env('MEMCACHED_USERNAME'),
                env('MEMCACHED_PASSWORD'),
            ],
            'options'    => [
                // Memcached::OPT_CONNECT_TIMEOUT  => 2000,
            ],
            'servers' => [
                [
                    'host' => env('MEMCACHED_HOST', '127.0.0.1'),
                    'port' => env('MEMCACHED_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',

];
  

虽然我没有使用缓存来设置数据和检索数据。   有什么帮助吗?

1 个答案:

答案 0 :(得分:0)

错误是因为您的laravel文件夹中没有 storage / framework / cache / 目录,或者缺少此目录的写入权限。如果目录不存在,则创建该目录或为其分配写入权限。

注意:这是laravel默认缓存机制。