Skip to content
Advertisement

Apache / PHP error_log location in Docker

My PHP script has an error. For example, this shows this on the screen:

Warning: require(/var/www/foo.php): failed to open stream:

Where can I find this in the logs?

I tried docker logs containerName, but it only shows access logs. E.g.,

192.168.2.1 - - [17/Mar/2019:10:00:00 +0000] "GET / HTTP/1.1" 200 505 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64)...

It doesn’t show the PHP error above.

Going in the Apache logs folder inside the container via docker exec shows the following:

JavaScript

I’m not even sure if this is where the PHP logs are at, but I can’t view them.

Where can I find the Apache/PHP error logs in Docker?

Advertisement

Answer

Ensure that you have the following inside php.ini in order to be able to see the errors using docker logs -f containerName as in general, sending the logs to /dev/stdout and /dev/stderr makes you able to receive it through docker logs:

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