Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 664 Bytes

how-to-get-the-process-id-with-php-pcntl.md

File metadata and controls

28 lines (19 loc) · 664 Bytes

How to get the process ID with PHP PCNTL?

// plain

The process ID (PID) of a process can be obtained using the pcntl_getmypid() function in PHP PCNTL. This function returns the PID of the current process.

Example code

<?php
$pid = pcntl_getmypid();
echo "Process ID: $pid\n";

Output example

Process ID: 1234

Code explanation

  • pcntl_getmypid(): This function returns the PID of the current process.

Helpful links

onelinerhub: How to get the process ID with PHP PCNTL?