refactorian/laravel-docker

The stream or file "/var/www/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied

devmansurov opened this issue ยท 6 comments

When I run all these commands:

git clone https://github.com/refactorian/laravel-docker.git
cd laravel-docker
docker compose up -d --build
docker compose exec php bash
composer setup

And open the application itself in the browser I get this error:

The stream or file "/var/www/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied

Link to shared error

When I added the storage folder to the php service then I received this error:

    php:
        build: .docker/php
        ports:
            - 5173:5173
        volumes:
            - .:/var/www:cached
            - .:/var/www/storage

Then get this error:

There is no existing directory at "/var/www/storage/logs" and it could not be created: Permission denied

@devmansurov Hi ๐Ÿ‘‹ are you using Windows? Try these steps :

docker compose up -d --build
docker compose exec php chmod -R 775 storage bootstrap/cache
docker compose exec php bash
composer setup

docker compose exec php bash

Hi. I use Ubuntu. I tried all the commands according to your instructions but same error:

The stream or file "/var/www/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied

Note: Also docker buld cache was been cleared before running your commands using this command: docker builder prune -f

@devmansurov Try this:

docker compose exec php bash
chown -R www-data:www-data /var/www/storage /var/www/bootstrap/cache
chmod -R 775 /var/www/storage /var/www/bootstrap/cache

Please let me know if the problem was solved, I'll try to improve the environment.

chmod -R 775 /var/www/storage /var/www/bootstrap/cache

Thanks, works like a swiss watch!

But I have also Permission denied error with phpMyAdmin:

image

@devmansurov Try this:

docker compose exec phpmyadmin chmod 777 /sessions