The connection-handling functions allow PHP developers to handle user aborts and script timeouts gracefully. OverviewThe Zend engine tracks basic information about the state of the HTTP connection between a remote client and a PHP script. The connection can be in one of the following states: NORMAL, ABORTED, or TIMEOUT. The connection state is usually NORMAL. If the remote client disconnects (or experiences certain kinds of network errors), the status will become ABORTED. If the PHP script runs past the time limit imposed by the set_time_limit() function or the corresponding max_execution_time php.ini or Apache conf file directive, the state will become TIMEOUT. It's possible for a connection to be in both the ABORTED and TIMEOUT states. This will happen in cases where ignore_user_abort has been set via the ignore_user_abort() function or the corresponding ignore_user_abort in php.ini or Apache conf file directive, the user has attempted to abort the script, and the script has run past the maximum execution time.
WarningConnection handling may not operate properly on all platforms. Most notably, do not rely on these functions under the Windows family of operating systems. Connection-Handling ConstantsThe following constants should be used to compare against the values returned by the connection_status() function. These constants were added in PHP 4.0.7. Prior to this version, direct comparison against the integer values returned by connection_status() was required.
php.ini Directives Related to the Connection-Handling FunctionsThe following configuration directives can be used to control the behavior of the connection-handling functions.
Installing Connection-Handling SupportConnection handling is one of the PHP core functions and doesn't need to be built in. Table of Contents
PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing
(Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch).
This material may be distributed only subject to the terms and conditions set forth
in the Open Publication License, v1.0 or later (the latest version is presently available at
http://www.opencontent.org/openpub/).
The authors of this book have elected not to choose any options under the OPL. This online book was obtained
from http://www.fooassociates.com/phpfer/
and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4
for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All
persons and entities shall have neither liability nor responsibility to any person or entity with respect to
any loss or damage arising from the information contained in this book.
|