PHP Classes

File: examples/bg_process.php

Recommend this page to a friend!
  Classes of Alexandre Sinício   PHP Async Executor   examples/bg_process.php   Download  
File: examples/bg_process.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: PHP Async Executor
Run PHP scripts in parallel using the CLI version
Author: By
Last change:
Date: 2 years ago
Size: 307 bytes
 

Contents

Class file image Download
<?php
//A SIMPLE BACKGROUND PROCESS THAT WILL RUN FOR 5 SECONDS AND EXIT
global $argv;
array_shift($argv);

for(
$i=0; $i<5; $i++) {
   
$message = 'iteration '.$i.' -- we received params >> '.implode(' || ', $argv).PHP_EOL;
   
file_put_contents(__DIR__.'/bg_process_log.txt', $message, FILE_APPEND);
   
sleep(1);
}