7

I have written some code that I run remotely on a server via the php-cli and a particular method within this code (I'm unsure which method at the moment) is causing a segmentation fault.

Apart from adding exit and echo calls down through my methods and manually pinpointing the bad bits - is there a way to catch the segmentation fault as it happens and find out what piece of the puzzle is crashing? Standard PHP errors are displayed through the error shutdown handlers, I'm unsure where to start with this segmentation fault.

Cheers!

hakre
  • 193,403
  • 52
  • 435
  • 836
Jessedc
  • 12,320
  • 3
  • 50
  • 63

1 Answers1

3

Yes. With the GNU Debugger: how-to-debug-a-segmentation-fault-caused-by-php

Or by setting the flag DBIG_SECURITY_HOLE when you compile php: Fixing Apache Segmentation Faults Caused by PHP

Take a look at bugs.php.net maybe there is a related known bug in the PHP source.

Besnik
  • 6,469
  • 1
  • 31
  • 33
  • Thanks for the links @Besnik. The particular PHP scripts I'm running have nothing to do with Apache, but it's a reasonable start at catching the seg faults. – Jessedc Jul 18 '12 at 00:54
  • Both links are about Apache? – SOFe Mar 23 '16 at 06:46