My PHP script has an error, for example, this shows in 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:
root@c9e29891dc0d:/var/log/apache2# ls -hltra
total 0
lrwxrwxrwx. 1 www-data www-data 11 Feb 6 04:42 other_vhosts_access.log -> /dev/stdout
lrwxrwxrwx. 1 www-data www-data 11 Feb 6 04:42 error.log -> /dev/stderr
lrwxrwxrwx. 1 www-data www-data 11 Feb 6 04:42 access.log -> /dev/stdout
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?
What about ensuring 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
log_errors = On
error_log = /dev/stderr