1

The page keeps on loading when open link. On some pages it is fixed by putting exit(); after header('location:link'); statement.

The problem usually occurs when I open two or more pages of the website together. When this occurs any request to any further page on this site not opens but keeps loading. The page then opens after 10 to 20 minutes.

When pages keeps loading and I open any other page of this site in a new tab, Live HTTP Headers shows that request is not sent.

Any help?

Antony
  • 14,900
  • 10
  • 46
  • 74
Umair Anwar
  • 522
  • 1
  • 4
  • 15
  • 2
    ALWAYS put an exit after a header("Location: link"); But it sounds like your scripts are not finishing and your session remains locked, preventing further access. (this happened to me when loading large datasets into a database, my solution was to session_write_close which allowed another tab on same site to continue working) http://www.php.net/manual/en/function.session-write-close.php – Waygood May 14 '13 at 12:22
  • 2
    There is not enough information here to be able to give you any answers really. It could virtually be any number of things. – adamj May 14 '13 at 12:23

1 Answers1

0

A header location should always be followed by an exit(); to prevent further execution of code below this point.

You may find closing access to the session will aid you further as this can lock other pages from accessing it, until that script has finished.

session_write_close();
header("Location: URL");
exit();

See: Why I have to call 'exit' after redirection through header('Location..') in PHP?

http://www.php.net/manual/en/function.session-write-close.php

Community
  • 1
  • 1
Waygood
  • 2,657
  • 2
  • 15
  • 16