PHP Classes

Example usage

Recommend this page to a friend!

      PHP Background Process  >  All threads  >  Example usage  >  (Un) Subscribe thread alerts  
Subject:Example usage
Summary:Example usage
Messages:1
Author:Joshy Francis
Date:2017-10-30 06:55:19
 

  1. Example usage   Reply   Report abuse  
Picture of Joshy Francis Joshy Francis - 2017-10-30 06:55:19
Example, Procedural style.

$cmd='';
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {//'This is a server using Windows!';
$cmd= $php_path.'\php.exe '.$path.'\long_process.php' ;
}else{
$cmd='/usr/bin/php -f /var/www/example.com/public/long_process.php';
}
$pid=run_process($cmd);
if(is_process_running($pid)){
echo 'Process running';
stop_process($pid);
}else{
echo 'Process not running';
}