Strace

user=`pwd | cut -d \/ -f 3`; x=1; while [ $x = 1 ]; do process=`pgrep -n -u $user php`; if [ $process ]; then x=0; fi;  done; strace -vvttf -s 256  -p $process 2>&1| tee strace 

General examples: http://www.thegeekstuff.com/2011/11/strace-examples/
Some more real-world: http://www.rrsoft.co/2013/12/09/using-strace-and-lsof-to-track-down-process-hangs-2/