I have my page which make an Ajax call to my PHP script searching for data in the database. When I refresh the page multiple times consecutively, my host's number of processes limit on 20 reached (20/20). Because of that, no more php script can be executed until the processes number gets down in like 3 or more minutes.

What's going on on the host when the page gets called and how to fix it? Let's say if 30 people (even less) log on my website, my website will crash.

Here is my script:

//Some logic code
session_write_close();

//It was 400
set_time_limit(60);

$genMesaj = false;

do {
    sleep(5);

    //Some codes to search on the database

   //In case some data found
   \session_start();
   session_write_close();

    $genMesaj = //true or false;
} while (!$genMesaj);

0 Answers