Hi, I was debug a PHP74 problem that appears to be constantly crashing our web server with zend_mm_heap corrupted, seg fault (11) and bus error (10) problems. The problem is that we are configured for event_mpm and PHP with ZTS, but ZTS and DEBUG do not play nicely together. On top of this, unless we reconfigure the system to pre-fork, Apache does not appear to let us compile without ZTS, and disabling ZTS breaks compilation of a whole bunch of php-extensions when combined with DEBUG. While PHP is not necessarily your concern, I am trying to find out if we really need to be using ZTS when using event_mpm. One person in the PHP I was speaking too was actually baffled as to why I ever had ZTS enabled in the first place, until I tried to explain that I can't use event_mpm without it on FreeBSD. Do you have any ideas as to if ZTS is absolutely needed for event mpm? Worst case I can try switch to pre-fork, but I would rather avoid it unless necessary. Thanks!
Are you using mod_php with ZTS and the event MPM?
I think the correct way to do it is to use php-fpm so PHP runs as a separate daemon and not as an apache module. Which should eliminate thread safety issues and thus not require ZTS. This is how its always done (as far as I know) with nginx and should be the correct way with worker or event mpm apache.
(In reply to Bill Sorenson from comment #1) Ya, we've been using it for almost a decade now, give or take. It's worked well! Funny enough, this almost exact same problem (wasn't about DEBUG, specifically) happened around ~5 years ago I think? The last time, it also was confusing and a headache to get sorted out and get to the bottom of the problem to find out it was this extra "-zts" path problem and dependency stuff. As for "correct", I would say it's more just different. Despite the performance hit, which for us is negligible, I much like the app managed file overrides, tbh. But one of the PHP folks was mentioning that ZFS shouldn't even be a problem with mod_php since it's a forked process itself, and does it's own threading, as I understand what they were describing. Either way, it's not fun when bugs like this creep up! :)
Officially PHP say not to use mod_php with anything but prefork mpm in apache. I believe it is specific to mod_php rather than php and threads in general. I'm not sure how often zts is actually used and if debug+zts works on other platforms. I'll try to investigate. My best guess is it isn't specific to FreeBSD. https://www.php.net/manual/en/install.unix.apache2.php
(In reply to Bill Sorenson from comment #4) Thanks for the URL! On the topic of event MPM and PHP, I understand the reasoning, which is exactly where we are right now: we have a bug somewhere in the PHP pipeline causing segmentation faults, php heap corruption, etc., as well as the possibility of knocking out the web server in addition to the interpreter. While changing to php-fpm isn't off the table entirely, it appears that the underlying that I face is the inability to even debug the problem, which chat and logs suggest that spending a bunch of time trying php-fpm likely wont solve either since it crashes the interpreter. What I really need is to be able to build a DEBUG build :) If there is anything you can think of, or need from me, just give me a shout! In the meantime, some cron'd graceful restarts seem to at least keep the problem at bay long enough for the bug reports to start getting the ball rolling. Thanks btw!