Unable to create the "cache" directory
JoniJnm opened this issue · comments
Using ubuntu 20.04, after the make build
and going http://localhost:8030/health-check, it shows an error:
Unable to create the "cache" directory (/app/apps/mooc/backend/var/cache/test).
The exception is thrown at /app/vendor/symfony/http-kernel/Kernel.php
line 637
The owner of the folders is my user (uid 1000):
$ docker exec -it codelytv-php_ddd_skeleton-mooc_backend-php /bin/bash
bash-5.1# ls -la /app/apps/mooc/backend
total 28
drwxrwxr-x 7 1000 1000 4096 Dec 5 14:52 .
drwxrwxr-x 4 1000 1000 4096 Oct 2 09:56 ..
drwxrwxr-x 2 1000 1000 4096 Oct 2 09:56 bin
drwxrwxr-x 4 1000 1000 4096 Oct 2 09:56 config
drwxrwxr-x 2 1000 1000 4096 Oct 2 09:56 public
drwxrwxr-x 4 1000 1000 4096 Oct 2 09:56 src
drwxrwxr-x 3 1000 1000 4096 Oct 2 09:56 tests
bash-5.1#
I tried to create a folder in a tmp folder with:
mkdir('/tmp/test-folder', 0777);
the result:
$ docker exec -it codelytv-php_ddd_skeleton-mooc_backend-php /bin/bash
bash-5.1# ls -la /tmp
total 16
drwxrwxrwt 1 root root 4096 Dec 5 15:04 .
drwxr-xr-x 1 root root 4096 Dec 5 14:51 ..
drwxr-xr-x 3 root root 4096 Dec 5 14:50 apcu
drwxrwxrwx 2 www-data www-data 4096 Dec 5 15:04 test-folder
So it seems like the php proccess is running with www-data user (instead of mine: 1000)
The problem occurs with master and php8.1 branches
there is a PR #292
Run these commands:
mkdir apps/mooc/backend/var
chmod -R 777 apps/mooc/backend/var
mkdir apps/backoffice/backend/var
chmod -R 777 apps/backoffice/backend/var