4

Suppose I have a pretty lengthy PHP script taking exactly 60 seconds.

I connect to mysite.com/thatscript.php, I'm pretty sure I connected, then the script starts running. After 5 seconds I hit escape. Then I hit Ctrl+R, and wait another 5 seconds, then repeat 12 times.

What will happen and why?

/edit: I actually tested and it puts me to wait but I can't distinguish whether Apache keeps me waiting, or another concurrent script, or whatever.

Silviu-Marian
  • 10,105
  • 5
  • 45
  • 71

1 Answers1

5

It depends on what PHP is doing.

Pressing esc will normally stop a browser loading the page.

If you lengthy script is also using a session, then all other request will wait until the previous script finished because of session locking.

Session locking related: How does session_start lock in PHP?

If you want to control how PHP handles the user stopping the request look at: http://php.net/manual/en/features.connection-handling.php

Community
  • 1
  • 1
Petah
  • 44,167
  • 27
  • 153
  • 209