fcgi-debug helps you to trace what happens with your fastcgi programs without having to strace them; it just sits between webserver and your fastcgi program and forwards all content while analysing it.
Example usage (assuming the binary is in build/fcgi-debug, starts a fastcgi server listening on port 1026):
spawn-fcgi -C 0 -p 1026 -n -- build/fcgi-debug /usr/bin/php5-cgi
For running you probably want spawn-fcgi.
git clone git://git.lighttpd.net/fcgi-debug.git cd fcgi-debug (mkdir build && cd build && cmake .. && make)