如何获得 apache 核心转储?

And*_*ann 8 server debugging apache2 gdb 14.10

我的 14.10 Ubuntu 服务器有问题。执行某些操作后,我的 apache2 重新启动并出现分段错误错误。为了调试这个问题,我想创建一个核心转储。我做了以下工作:

  • 添加CoreDumpDirectory /tmp/apache-coredumps到配置文件中
  • ulimit -c unlimited
  • apt-get install apache2-dbg php5-dbg
  • 重新启动apache并导致错误。日志声称目录中可能有核心转储,但它是空的。

我也尝试在 apache2 的可执行文件上直接使用 gdb,但是 apache 除非通过apachectl或启动,否则不会启动service apache2 start

如何获得核心转储来调试我的问题或如何gdb直接附加到 apache?

Jay*_*ren 4

ulimit -c unlimited只影响你当前的 shell。

您可以通过查看输出来确认这一点cat /proc/$(pidof -s apache2)

我添加ulimit -c unlimited/etc/default/apache2现在cat /proc/$(pidof -s apache2)/limits包括

Max core file size        unlimited            unlimited            bytes
Run Code Online (Sandbox Code Playgroud)