Answer the question
In order to leave comments, you need to log in
Correctly issuing a response to the client and continuing to execute PHP code?
The task arose, with an ajax request, give the client only the necessary data and continue the execution of the php code already in the background. Since the server is used by Apache, the following code was implemented:
ob_start();
echo json_encode($info); //отдаем клиенту нужные данные
$contentLength=ob_get_length();
header('Connection: close');
header('Content-Length: ' . $contentLength);
ob_end_flush();
ob_flush();
flush();
//продолжаем выполнение
Answer the question
In order to leave comments, you need to log in
Close php session session_write_close()
Better use php-fpm and fastcgi_finish_request
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question