| Version 5 (modified by richo, 11 months ago) |
|---|
Generating a Backtrace
If you don't have a core file yet
Read generating a Backtrace on php.net.
- config xcache.coredump_directory in /etc/php.ini, For apache + mod_php, you have CoreDumpDirectory in apache.conf
- Ensure that the xcache.coredump_directory has write permissions for the user who's running PHP
- Remove any limits you may have on core dump size from your shell:
- tcsh: unlimit coredumpsize
- bash/sh: ulimit -c unlimited
- Cause PHP to crash:
- PHP CGI: Simply run php with the script that crashes it
- PHP FastCGI: Simply setup normal webserver-fastcgi configuration, and access the script that crashes PHP
- PHP As Apache Module: Run httpd -X, and access the script that crashes PHP
Once you have the core file
First, check where the coredump is
Checking where the coredump is
$ grep xcache.coredump_directory /etc/php.ini xcache.coredump_directory = "/tmp/" $ ls /tmp/core /tmp/core
- PHP as CGI/FastCGI: Run gdb with the path to the PHP or PHP-enabled httpd binary, and path to the core file, for example:
Generating backtrace for PHP as CGI/FastCGI
$ gdb /usr/local/bin/php-cgi-fcgi /tmp/core
........
(gdb) bt
(gdb) source ~/src/php5/.gdbinit
(gdb) dump_bt executor_globals.current_execute_data
- PHP As Webserver Module: Run gdb with the path to the PHP or PHP-enabled httpd binary, and path to the core file, for example:
Generating backtrace for PHP as As Webserver Module
$ gdb /usr/local/apache/sbin/httpd /tmp/core
........
(gdb) bt
(gdb) source ~/src/php5/.gdbinit
(gdb) dump_bt executor_globals.current_execute_data

