Skip to content
Advertisement

Laravel 5.7 unable to load `storage/framework/cache/data` and write into `./storage/logs/laravel-2019-06-11.log`

I have a project under laravel 5.7 installation and for some reason I get the following error:

JavaScript

In order to mitigate the error I tried the following:

  • Permission Based tries:
JavaScript
  • artistan based attempts:
JavaScript
  • php-fpm default user settings:
JavaScript

Also for the development I use vagrant with the following Vagrantfile located at the root of my project:

JavaScript

But any of these failed to resolve the solution.

Edit 1

The folder framework/cache/data already exists as ls -l shows:

JavaScript

By doing:

JavaScript

Resulted to the following NEW error:

JavaScript

So in my investigation shows:

JavaScript

Meaning it has more than enouch permissions to get written. I also run the following command:

JavaScript

Meaning that still there are good enouch permissions in order for the laravel to write into the file. Still the error shows the opposite.

Furthermore I tried this one:

JavaScript

I also tried the following:

JavaScript

And the problem still remains.

Advertisement

Answer

The problem is that the code is running as www-data user. To fix tat you should make a custom php-fpm pool using the user and group named vagrant.

It is achieved via this configuration php-fpm configuration:

JavaScript

And use tcp://127.0.0.1:9001 into nginx configuration. Alternatively you can use the default (www) pool in case that all php scripts are being executed using a single user:

JavaScript

More info is located here: https://serversforhackers.com/c/php-fpm-multiple-resource-pools (keep in mind that for later php versions replace the /etc/php5 part of paths with the /etc/php^Version^ where ^Version^ is the desired version of php.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement