Is there a command that I can run that would expose what scripting is showing a php process in top or ps aux


2 Answers 2


Since you're using php-fpm, I only see a couple of ways to see what it's doing/done.

php-fpm Status page
You'll have to configure the php-fpm status page with the pm.status_path directive, as outlined in the docs.

Then you'd need to tell your web server to pass whatever path you used in pm.status_path to php-fpm. That method will depend entirely on the web server.

Once that's done, you'd access the php-fpm status page and use the full query parameter to show all the workers (http://servername/status-phpfpm?full, if you setup pm.status_path as status-phpfpm).

That said, this won't show you the full history of what scripts have run, just what each worker last ran or is currently running.

Web Server logs
Check the access logs for your web server.

They'll show you what has run, and if all your PHP is in given directory, or ends with a .php extension, it should be fairly easy to find using grep. Depending on your document root, aliases, URL rewrites and other web server configurations, you might have to do a little bit of interpretation from those logs to find the full file system path of a given script though.

This method won't show you what's currently running because, as far as I know, most web servers only write to their access logs after the request has finished and an HTTP reply has been sent. This is so that it can log the size and status code.


Commands you can use:

pstree | grep php
ps aux | grep php

pstree - pstree info

ps - ps info

The "aux" switches show you:

  • all the users' processes
  • show you the process listed in a user oriented fashion (by user names)
  • show you all processes, not just ones attached to a terminal. This will include processes such as services like crond, upowerd, etc.

grep -- grep info

  • It would be helpful to include some text about the commands... Sep 29, 2015 at 21:22
  • 1
    Added some info about the commands.
    – bentek
    Sep 30, 2015 at 13:46
  • 6
    This won't work since php-fpm doesn't show the script in ps or pstree.
    – GregL
    Sep 30, 2015 at 14:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .