Php get current process id
(PHP 4, PHP 5, PHP 7, PHP 8) Show getmypid — Gets PHP's process ID Descriptiongetmypid(): int|false ParametersThis function has no parameters. Return Values Returns the current PHP process ID, or NotesWarning Process IDs are not unique, thus they are a weak entropy source. We recommend against relying on pids in security-dependent contexts. See Also
Radu Cristescu ¶ 9 years ago
('LOCK_FILE', "/var/run/" . basename($argv[0], ".php") . ".lock"); Robert Mays Jr ¶ 11 years ago
brooke at jump dot net ¶ 18 years ago
Kevin Traas (ktraas- at -gmail dot com) ¶ 12 years ago
( 'LOCK_FILE', "/var/run/".basename( $argv[0], ".php" ).".lock" );
martijn at nowhere dot com ¶ 6 years ago
brospam at gmail dot com ¶ 9 years ago
Erickson Reyes ercbluemonday at yahoo dot com ¶ 12 years ago
$commands as $command) { eight_hf at live dot fr ¶ 10 years ago
kroczu at interia dot pl ¶ 16 years ago
function getpidinfo($pid, $ps_opt="aux"){
$ps=shell_exec("ps ".$ps_opt."p ".$pid);
Pure-PHP ¶ 17 years ago
("ProcessHandler.class.php");
wouter99999 at gmail dot com ¶ 11 years ago
james at voodoo dot co dot uk ¶ 12 years ago
pdc at example dot com ¶ 10 years ago
$result;
gabe at fijiwebdesign dot com ¶ 12 years ago
How to get PID in PHP?$command = 'yourcommand' . ' > /dev/null 2>&1 & echo $!; '; $pid = exec($command, $output); var_dump($pid);
How can I see what processes are running PHP?Depending on your setup this could be managed via fast-cgi or mod_php or even php-fpm. If you use mod_php , then there will be no "php processes" visible for ps . You can still see if your PHP engine is in use by using lsof : $ lsof -ln [...]
How can I tell if PID is running on Linux?The easiest way to find out if process is running is run ps aux command and grep process name. If you got output along with process name/pid, your process is running.
|