It's better to recompile PHP with --enable-debug
to have debug
Usually that is wrong approach - various products add lots and lots of
various debug hooks when compiled with something like --with-debug
To get debugging symbols one just has to pass CFLAGS="-O3 -g"
CXXFLAGS="-O3 -g" to configure script.