PHP Classes
elePHPant
Icontem

File: long_process.php

Recommend this page to a friend!
  Classes of Joshy Francis  >  PHP Background Process  >  long_process.php  >  Download  
File: long_process.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: PHP Background Process
Run script in the background on Linux or Windows
Author: By
Last change:
Date: 7 months ago
Size: 490 bytes
 

Contents

Class file image Download
<?php
    ini_set
("max_execution_time", 3600);//seconds , works only for command line
   
set_time_limit(3600);//0= unlimited , works only for command line
   
        //$file=str_replace('\\','/',__DIR__.'/test.txt') ;
       
$file=str_replace('\\','/',dirname(__FILE__).'/test.txt') ;
   
    echo
$file;
    echo
'<br>';
   
   
file_put_contents($file , 'start');
       
sleep(15);
       
$s='';
    for(
$i=0;$i<1000;$i++){
       
$s.=$i.'<br>';
    }
        echo
$s;
   
   
unlink ($file);
       
sleep(15);
       
   
file_put_contents($file ,'stop');
   
?>