4

Is there a way to get the PHP script filename that is currently hammering my VPS?

For example, when I view "top", I see:

PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
7622 itil      17   0 61388  11m 6004 R 45.8  2.3   0:00.13 php
7626 itil      17   0 58360 8632 5440 R 24.6  1.6   0:00.07 php

How can I find out what file is being processed by PHP at that particular time?

psx
  • 235
  • 3
  • 14

1 Answers1

6

To show the arguments passed to the comand, use the next command:

ps v -C php

If you just see something like php somefile.php, get the current working directory using:

readlink /proc/$PID/cwd

replace $PID by the PID of the process as shown by ps.

Lekensteyn
  • 6,241
  • 6
  • 39
  • 55