gpt4 book ai didi

php - Laravel Cache 不在生产服务器上存储缓存文件

转载 作者:可可西里 更新时间:2023-10-31 23:40:13 26 4
gpt4 key购买 nike

我的 Laravel 缓存系统有问题(我使用的是 Laravel 4.1)。

  1. 在我的本地服务器上,Laravel 所在的“app/storage”文件夹存储缓存的文件具有 755 权限。
  2. 在我的生产服务器上,相同的文件夹具有相同的权限代码。
  3. 在我的本地服务器上,当我使用 Laravel 的缓存缓存数据时类,有效。所以如果我进入“app/storage”文件夹,我可以看到创建的文件。
  4. 在我的生产服务器上,它没有.. 没有创建文件app/storage”中的缓存文件夹,而 session 和 View 文件夹(存在于应用程序/存储中)存储了文件。我可以确认因为它总是使用 has 方法进入我的 if 语句,即使我使用缓存类的 put 方法放置我的 $datas

编辑

/*
|--------------------------------------------------------------------------
| Default Cache Driver
|--------------------------------------------------------------------------
|
| This option controls the default cache "driver" that will be used when
| using the Caching library. Of course, you may use other drivers any
| time you wish. This is the default when another is not specified.
|
| Supported: "file", "database", "apc", "memcached", "redis", "array"
|
*/

'driver' => 'file',

/*
|--------------------------------------------------------------------------
| File Cache Location
|--------------------------------------------------------------------------
|
| When using the "file" cache driver, we need a location where the cache
| files may be stored. A sensible default has been specified, but you
| are free to change it to any other place on disk that you desire.
|
*/

'path' => storage_path(). DIRECTORY_SEPARATOR . 'cache',

/*
|--------------------------------------------------------------------------
| Database Cache Connection
|--------------------------------------------------------------------------
|
| When using the "database" cache driver you may specify the connection
| that should be used to store the cached items. When this option is
| null the default database connection will be utilized for cache.
|
*/

'connection' => null,

/*
|--------------------------------------------------------------------------
| Database Cache Table
|--------------------------------------------------------------------------
|
| When using the "database" cache driver we need to know the table that
| should be used to store the cached items. A default table name has
| been provided but you're free to change it however you deem fit.
|
*/

'table' => 'cache',

/*
|--------------------------------------------------------------------------
| Memcached Servers
|--------------------------------------------------------------------------
|
| Now you may specify an array of your Memcached servers that should be
| used when utilizing the Memcached cache driver. All of the servers
| should contain a value for "host", "port", and "weight" options.
|
*/

'memcached' => array(

array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100),

),

/*
|--------------------------------------------------------------------------
| 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',

你知道我做错了什么吗?

最佳答案

将文件夹的权限从 755 设置到 777,看看是否有效。如果缓存现在工作,那么你有权限问题。将其重新设置为 755 并确保您的 Web 服务器使用的用户是您的文件夹的所有者。

关于php - Laravel Cache 不在生产服务器上存储缓存文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26383630/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com