Topic: How to troubleshoot a PHP crash?

I'm using PHP 7.2.2 from remirepo, on a RHEL 7 server. We host a couple hundred Web sites, and we've found a couple specific pages on one site that consistently crash PHP.

(They're WordPress sites, but that shouldn't matter. The usual WordPress troubleshooting steps haven't helped much so far -- when we enable WordPress' WP_DEBUG setting, the problem actually goes away...)

When we were using Apache and mod_php, visiting one of these problem pages would completely kill the Apache httpd child process service the page. We switched to php-fpm, and visiting these pages crashes the php-fpm child process serving the page, but at least with php-fpm we can easily get a core dump. So I have a couple core files to look at.

There's no php-fpm debuginfo package, so running gdb on the core dump doesn't tell me very much. And in any event, nobody in my team is really familiar with gdb, so we're a bit lost. Here's the backtrace, for what it's worth:

(I ran 'gdb /usr/sbin/php-fpm ./my-core-file)
(gdb) bt
#0  0x000055d1464b3b30 in _emalloc ()
#1  0x000055d1464646db in php_var_unserialize_internal ()
#2  0x000055d146464913 in php_var_unserialize_internal ()
#3  0x000055d146464913 in php_var_unserialize_internal ()
#4  0x000055d146453a5f in zif_unserialize ()
#5  0x000055d14658818b in execute_ex ()
#6  0x000055d14658dcfe in zend_execute ()
#7  0x000055d1464dbb73 in zend_execute_scripts ()
#8  0x000055d146476a68 in php_execute_script ()
#9  0x000055d1462ec36a in main ()

Any suggestions on how to proceed?

Re: How to troubleshoot a PHP crash?

> There's no php-fpm debuginfo package

The php-debuginfo provides needed data for all binaries (so for php-fpm).

BTW, as the issue occurs in unserialize; need to find the serialized data raising this segfault
Also probably not specific to build in my repo, so better to report upstream.

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: How to troubleshoot a PHP crash?

Thanks! I didn't know that php-debuginfo covered php-fpm.

I installed it, then learned about gdbinit, and at least now I have a lot more information to go on. (It looks like PHP's trying to malloc RAM while unserializing a string and something bad is happening, but I'm way out of my depth here.)

Re: How to troubleshoot a PHP crash?

smile