Home » Php » apache – 2 different php request at same time per user

apache – 2 different php request at same time per user

Posted by: admin July 12, 2020 Leave a comment


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

How to&Answers:

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.


Also, look at your debug settings if you are developing. I have this in my .htaccess:

php_flag xdebug.remote_enable on
php_flag xdebug.remote_connect_back on
php_flag xdebug.remote_autostart on

And that creates the same behaviour.