Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nginx close keep-alive connection from php

Hello Everybody

I have trouble with nginx server . I have configured nginx with keep alive connection.

keepalive_timeout 65;

And connect to server with persistent connection , i send many request to server in same connection .

I want to close persistent connection from php. php exit and die command closes response , not connection . And client can resend to server request in same connection .

simply, i want to close persistent connection from php

I use this command ,

header('Connection:close');

But not affected , connection is still alive

How can close http connection from php

like image 549
Taleh Ibrahimli Avatar asked Jan 28 '26 07:01

Taleh Ibrahimli


1 Answers

I took SO long to find the answer to this.

In PHP you need to call:

fastcgi_finish_request();
like image 163
Jordie Avatar answered Jan 30 '26 22:01

Jordie