I have a website which has 2 pages , (home_page.php and action_page.php)Action page takes aprx. 2 minutes to completely load (server side takes 2 minutes) . But if user clicks to home page link while action page is loading , browser does not go to home page , until action page is completely loaded. Same thing if the home page is opened in a new tab.
First of all what is the reason of this ? (bowser ? php ? apache ?) and how can I avoid this ?
Thank you
More than likely, it's because a session is locked. PHP will only allow one request per session to prevent issues coming up (overwriting data, etc). See: session_write_close()...
If the page is taking 2 minutes to load, then you are reaching the network timeout limits of a typical browser. That is a really long time for a page to load. You may want to consider spawning a separate process to do handle the long processing. You can put the result in a database, file, etc and use polling to check if it's done.
When spawning a process (exec()), make sure you use nohup, background it (&) and direct error output to /dev/null, otherwise it won't disconnect from the web process, and the web process will wait for it to finish.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With