Home Tutorial Php Phpfeature Tutorial PHP Connection Handling

 
 

Share on Google+Share on Google+
PHP Connection Handling
Posted on: March 31, 2010 at 12:00 AM
Advertisement
In this tutorial we will study about connection control, various values of connection control etc. Examples in this tutorial will make it more clear.

Connection Handling:

PHP internally maintains a connection status and it has three states:

  • 0 - NORMAL
  • 1 - ABORTED
  • 2 - TIMEOUT

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.

 

Advertisement

Related Tags for PHP Connection Handling:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: March 31, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com