I had a segmentation fault in a php script that I was running using php-cli and couldn’t trace where the problem was occuring using simple print statements.
Whilst searching for “php segmentation fault” I found out about gdb, a debugger that can be used to examine your php program.
Downloading and install to a Redhat server was done using: up2date gdb.
Once installed, I issued the following commands
- gdb php which opens the interface
- run scriptname.php
The script did segfault again so then I issued the gdb command bt which prints the backtrace.
I then followed the commands as written here in the section “Locating which function call caused a segfault:”
I found my problem was in a hashing function that I had written. Fixed the problem and my script is running without problems.
I hope this helps.
Comments (0)