Docker中的Apache/PHP error_log位置? [英] Apache / PHP error_log location in Docker?

查看:79
本文介绍了Docker中的Apache/PHP error_log位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的PHP脚本有错误,例如,此错误显示在屏幕中:

My PHP script has an error, for example, this shows in the screen:

警告:require(/var/www/foo.php):无法打开流:

我在哪里可以找到日志?

Where can I find this in the logs?

我尝试了 docker logs containerName ,但是它只显示访问日志.例如,

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" 200505-""Mozilla/5.0(Windows NT 6.1; Win64; x64)...

它没有显示上面的PHP错误.

It doesn't show the PHP error above.

通过 docker exec 进入容器内的Apache日志文件夹将显示以下内容:

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

我什至不确定这是否是PHP日志所在的位置,但是我无法查看它们.

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

在哪里可以找到Docker中的Apache/PHP错误日志?

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

推荐答案

如何确保在 php.ini 中包含以下内容,以便能够使用 docker查看错误通常使用-f containerName 日志,将日志发送到/dev/stdout /dev/stderr ,使您能够通过 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

这篇关于Docker中的Apache/PHP error_log位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆