tags:

views:

56

answers:

2

I have a php script running on OSX snow leopard. When I run it from the command line it throws 'Segmentation Fault'. If I put an exit() at the end of the file, it doesn't throw the error. Why is the exit needed?

A: 

I've had segfaults like this when extensions don't play nicely together. In one case it was curl and pgsql, and swapping the order they were loaded made the problem go away. (Swap the extension.so lines in php.ini, or rename files (z-curl.ini, for example) if you have a conf.d setup.)

Greg
A: 

Without seeing code it's tough to answer. Try a divide and concur method of debugging: Disable all the code with a comment. See if the problem occurs. If not, enable the first half of the code. If the problem reappears, disable all but the first quarter of the code. Continue to divide and concur until you find the part of the script that's causing the problem.

My guess would be you're not closing some open handle. But again I'm just guessing as I can't see the code.

Josh