Analyzing Apache/PHP Core Dump
I have been getting the occasional Seg Fault from apache so I enabled core dump on my servers to try to figure out what is going on. Last night I got another one and was trying to examine the core dump to find out what's going on. It's definitely a PHP process so I Googled how to examine these specifically for PHP. I downloaded the .gdbinit file for PHP 5.2 and I ran the following on the dump file:
$ gdb apache2 dumpfile
[reading/loading symbols]
(gdb) bt
[...backtrace...]
(gdb) source ~/.gdbinit
(gdb) dump_bt executor_globals.current_execute_data
Attempt to extract 开发者_如何转开发a component of a value that is not a structure.
I should be getting a backtrace after dump_bt executor_globals.current_execute_data
for the PHP script that caused the seg fault, but I keep getting Attempt to extract a component of a value that is not a structure.
instead.
At the first time, I got the same problem with you. Run again the bt and dump_bt commands and it works:
(gdb) dump_bt executor_globals.current_execute_data
Attempt to extract a component of a value that is not a structure.
(gdb) bt
#0 0x00002af8f874a5da in AppendImages () from /usr/lib64/libMagick.so.10
#1 0x00002af8f84586ce in MagickAppendImages () from /usr/lib64/libWand.so.10
#2 0x00002af8f81a3ad8 in zim_imagick_appendimages (ht=<value optimized out>, return_value=0x2af8f9ded108,
return_value_ptr=<value optimized out>, this_ptr=<value optimized out>, return_value_used=<value optimized out>)
at /var/tmp/imagick/imagick_class.c:8790
(gdb) dump_bt executor_globals.current_execute_data
[0xe8609940] appendimages() /var/www/html/xx/yy.php:803
[0xe8605070] genCode() /var/www/html/xx/zz.php:127
精彩评论