Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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?

share|improve this question
up vote 6 down vote accepted

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.

share|improve this answer
Thanks, ps does the job. Is there a way to get the arguments in top? – psynnott Mar 16 '11 at 16:06
Press the "c" key while top is running. – BMDan Mar 16 '11 at 16:11
excellent stuff, thanks. – psynnott Mar 16 '11 at 16:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.