PHP internally maintains a connection status and it has three states:
PHP script is normally running on normal state. If client side disconnected due to any reason the aborted state is turned on. A client usually disconnect from server side by the hitting his stop button. If PHP previously set the time limit then timeout state is turned on.
We can decide whether or not a client get disconnected to cause our script to be aborted. It is always useful to have our scripts run to culmination even if the client's browser does not receive the output. The default behavior of our script should be aborted when the remote client disconnects. If we do not tell PHP to ignore a manual (user) abort and the user aborts, your script will terminate.
Our script can be ceased by the inbuilt script timer. The default time is 30 seconds. The value can be changed by using the max_execution_time php.ini directive or the php_value max_execution_time
Both the aborted and the timeout states can be active at the same time. This is possible if PHP has been instructed to dismiss user aborts. PHP will still consider that a user can have broken the connection, but the PHP script will keep running. If the time limit hits, it will be aborted.
Recommend the tutorial