Is the PHP script executed by apache, killed when the HTTP connection dies?

I am running the standard Apache configuration with PHP. I am wondering what happens when a client requests a page that invokes the execution of a PHP script, then the client kills the request from the server until the script completes. Can Apache kill the script in any way, or is it still allowed to complete?

+6
source share
1 answer

The documentation answers this:

When the PHP script is running normally, the NORMAL state. If the remote client disables the ABORTED status flag is enabled. Remote shutdown of the client is usually caused by the user pressing the STOP button. If the PHP deadline is set (see set_time_limit ()), the TIMEOUT status flag is enabled.

You can decide whether you want the client to disconnect so that the script will interrupt. Sometimes it’s convenient to always run your scripts to completion, even if there is no remote browser receiving the output. However, the default behavior for your script will be aborted when the remote client disconnects. This behavior can be set via the ignore_user_abort directive php.ini as well as through the corresponding php_value ignore_user_abort Apache httpd.conf or with ignore_user_abort (). If you do not tell PHP to ignore user interrupt and the user is interrupted, your script will terminate.

If you want to tell the remote client that the script has completed, but continue processing after the request, nevertheless, see this question / answer .

+8
source

Source: https://habr.com/ru/post/887127/


All Articles