Answer the question
In order to leave comments, you need to log in
Is it possible to access PID in linux from PHP?
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2788 root 15 -5 0 0 0 S 2.0 0.0 404:43.97 md3_raid1
7961 root 20 0 5964 2528 1684 R 2.0 0.2 0:00.14 top
6629 root 20 0 8612 2884 2096 S 0.7 0.3 0:00.96 dovecot-auth
57 root 15 -5 0 0 0 S 0.3 0.0 4:36.10 kblockd/0
8703 ulogd 20 0 17700 4216 656 S 0.3 0.4 87:23.98 ulogd
11336 ldap 20 0 394M 15M 8292 S 0.3 1.5 5:29.28 slapd
25757 ldap 20 0 394M 15M 8292 S 0.3 1.5 5:11.71 slapd
Answer the question
In order to leave comments, you need to log in
php.net/manual/ru/function.getmypid.php or, as already mentioned, exec() and execute ps -aux | grep "php"
If there is a dira /proc/<pid>.
For each running process in Linux, the above dira is created. Inside are files that contain a lot of interesting things. Look at the contents of the directory yourself - there is a storehouse of information about the process.
To send signals to processes, you can use the posix_kill function (see the description in the puff manual). If this function is not available, then use exec, system, shell_exec, etc.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question