Mugoma J. Okomba Mugoma J. Okomba - 1 month ago 17
PHP Question

Laravel: Use absolute path for cache folder

We are using Lavarel 5 and would like cache folder separate from main application (probably even a different drive).

In config/cache.php we have:

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


However, Laravel in not using
<ABSOLUTE_PATH>
. Instead it creates
framework/<ABSOLUTE_PATH>
. In other words it interprets
<ABSOLUTE_PATH>
as a relative path.

How can we set absolute path for cache?

Answer

Remove the storage_path function from the string to put an absolute path in...

'path' => '/var/www/blah/'