Taleh Ibrahimli
Taleh Ibrahimli

Reputation: 759

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

Upvotes: 3

Views: 5273

Answers (2)

Jordie
Jordie

Reputation: 244

I took SO long to find the answer to this.

In PHP you need to call:

fastcgi_finish_request();

Upvotes: 8

regilero
regilero

Reputation: 30496

From this servfault answer it seems you can try it by allowing this header in the nginx fastcgi handler.

fastcgi_pass_header Connection-close;

Upvotes: 1

Related Questions