php - After running the script, browser hangs up. Other browsers works -


this question has answer here:

i wrote script exports data database , put xml file. script works in infinite while loop proper break statement (after task done). task takes 10 minuts. when make http request start job, browser i'm using completly freezes - not requested url whole host. in same time other browsers can browse webpage contains script.

snippet of php script:

while(true) {     if($i === $z)     {         break;     }      foreach((array)$this->project $project)     {         makeyourjob();         usleep(1000000);         $z++;     }     usleep(2000000); } 

script invoked jquery code (i type address of html page contains code):

    $.get("cron.php"); 

also tried type cron.php in url bar , browser hangs too. why browser runs script freezes? how avoid this?

edit: making simple get/post request ajax or user not resolve problem. post isn't duplicate. here solution:

exec("wget http://www.domain.com/scrip_name.php > /dev/null &"); 

clearly, if statement breaks infinite loop not being invoked.

can check initialization values of $i , $z? also, === checks if 2 variables of same type , of same value. i'd suggest check type of $i , $z variables.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -