title: how strace php-fpm process?
body: <p>I am using nginx+php-fpm for php environment and I want to strace the php script execute,but there are many php-fpm worker, so if how can I know which php-fpm worker is handling the script?  <br />
  if I should monitor all the php-fpm worker,example is as following:</p>
  
  <pre><code>additional_strace_args="$1"
  
  MASTER_PID=$(ps auwx | grep php-fpm | grep -v grep | grep 'master process'  | cut -d ' ' -f 6)
  
  while read -r pid;
  do
      if [[ $pid != $MASTER_PID ]]; then
          nohup strace -r -p "$pid" $additional_strace_args &gt;"$pid.trc" 2&gt;&amp;1 &amp;
      fi
  done &lt; &lt;(pgrep php-fpm)
  </code></pre>