I have a second issue. I run Symfony with api-platform in a Docker Container. However, this container's PHP keeps crashing. This particular issue happens when I run docker-compose up --build
(So with the --build
flag). The following error occurs, after which PHP exits with code 255.
#54 2.503 Script cache:clear returned with error code 255
#54 2.503 !! PHP Fatal error: Uncaught Symfony\Component\Dotenv\Exception\PathException: Unable to read the "/srv/api/.env" environment file. in /srv/api/vendor/symfony/dotenv/Dotenv.php:505
#54 2.503 !! Stack trace:
#54 2.503 !! #0 /srv/api/vendor/symfony/dotenv/Dotenv.php(60): Symfony\Component\Dotenv\Dotenv->doLoad()
#54 2.503 !! #1 /srv/api/vendor/symfony/dotenv/Dotenv.php(80): Symfony\Component\Dotenv\Dotenv->load()
#54 2.503 !! #2 /srv/api/config/bootstrap.php(17): Symfony\Component\Dotenv\Dotenv->loadEnv()
#54 2.503 !! #3 /srv/api/bin/console(30): require('/srv/api/config...')
#54 2.503 !! #4 {main}
#54 2.503 !! thrown in /srv/api/vendor/symfony/dotenv/Dotenv.php on line 505
#54 2.503 !!
After looking stuff up and three days worth trying to debug this issue I came across a few supposed solutions. On StackOverflow I only found one, which stated that Symfony requires an .env
file and the person asking should create one. Fun thing: The .env
file does exist. It is there, and was always working up until now. (Clean Factory Reset on Machine)
I checked permissions outside the srv
folder for all the .env
files, and they are read- and writeable. I'm not sure how to do this in the srv folder. But the thing is, I don't understand what the issue is at all. The error message seems pretty simple, but does not tell me what's going on.
Any suggestions on what the cause is and how to resolve this issue?