PHP 4, PHP 5, PHP 7, PHP 8
ignore_user_abort - Set whether a client disconnect should abort script execution
Code Examples

ignore_user_abort( [bool|null$enable = null] ): int

Sets whether a client disconnect should cause a script to be aborted.

When running PHP as a command line script, and the script's tty goes away without the script being terminated then the script will die the next time it tries to write anything, unless enable is set to true



If set and not null, this function will set the ignore_user_abort ini setting to the given enable. Otherwise, this function will only return the previous setting without changing it.

Return Values

Returns the previous setting, as an integer.


PHP will not detect that the user has aborted the connection until an attempt is made to send information to the client. Simply using an echo statement does not guarantee that information is sent, see flush.


Version Description
8.0.0 enable is nullable now.

Related Functions

Example of ignore_user_abort

Show all examples for ignore_user_abort

PHP Version: