FIle could not be opened in append mode: failed to open stream: Permission denied laradock FIle could not be opened in append mode: failed to open stream: Permission denied laradock laravel laravel

FIle could not be opened in append mode: failed to open stream: Permission denied laradock


This worked for me:

chown -R www-data:www-data "project foldername"


If you aren't running your application as root on your web server, then it wont have write access based on the permissions you've provided.

Checked from workspace container bash. storage/logs/ directory has drwxr-xr-x 2 root root 4096 Aug 1 07:37 logs

The error is complaining about permission denial for opening in append mode - it doesn't have permission to write to the file, only root does.

What you need to do is make your web server group the owner of the storage directory:

chown -R www-data:www-data /var/www/laravel-api/storage/

The www-data can be switched out for whatever group your web server is associated with.

To avoid completely repeating an amazing and complete answer, I recommend you give this answer a read:

How to set up file permissions for Laravel?


You need to run the following command. It works for me:

step 1:

sudo chmod -R +rwX .

step 2:

sudo chown -R $(whoami) .