zonelsk
zonelsk

Reputation: 245

How can I find out which PID belongs to which script?

i'm building a websocket with php.

I run script with

exec('php -q ../ws1/server.php');

and

exec('php -q ../ws/ws_server.php');

with

exec('pidof php');

i get PID's of running processes/scripts. (eg. 13697 and 13726)

How can I find out which PID belongs to which script?

Upvotes: 1

Views: 415

Answers (1)

Harikrishnan
Harikrishnan

Reputation: 9979

ps aux | grep pid

This will list all details of process including that script name.

Edit

from script

exec("ps aux | grep $pid", $output);
echo $output;

Upvotes: 3

Related Questions