Christian Studer Christian Studer - 1 year ago 79
PHP Question

Invoke external shell script from PHP and get its process ID

How can I invoke an external shell script (Or alternatively an external PHP script) from PHP itself and get its process ID within the same script?

Answer Source
$command =  'yourcommand' . ' > /dev/null 2>&1 & echo $!; ';

$pid = exec($command, $output);

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download