Discussion:
Persistent connections
Nibin V M
2013-10-25 10:10:00 UTC
Permalink
Hello,

I have been reading docs and many are telling that persistent connections
are kept open indefinitely. But I found in PHP docs that it will not close
after script execution like requesting a page; so should it close after
the request is over?

So when exactly a persistent connection should close?

Please advice.
--
Regards....

Nibin.
Stuart Dallas
2013-10-25 10:24:39 UTC
Permalink
Post by Nibin V M
I have been reading docs and many are telling that persistent connections
are kept open indefinitely. But I found in PHP docs that it will not close
after script execution like requesting a page; so should it close after
the request is over?
So when exactly a persistent connection should close?
Please advice.
A persistent connection is closed when the PHP process ends, or it gets disconnected by the server-side or due to a network error. Attempting to explicitly close a persistent connection will do nothing without complaining.

-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Nibin V M
2013-10-25 11:51:43 UTC
Permalink
Thank you for the quick response Stuart...one more doubt..at
http://php.net/manual/en/features.persistent-connections.php they states

=========
This means that when the same client makes a second request to the server,
it may be served by a different child process than the first time. When
opening a persistent connection, every following page requesting SQL
services can reuse the same established connection to the SQL server
=========

Is the persistent connection pool is re-used between apache child
processes ?
Post by Stuart Dallas
Post by Nibin V M
I have been reading docs and many are telling that persistent connections
are kept open indefinitely. But I found in PHP docs that it will not
close
Post by Nibin V M
after script execution like requesting a page; so should it close after
the request is over?
So when exactly a persistent connection should close?
Please advice.
A persistent connection is closed when the PHP process ends, or it gets
disconnected by the server-side or due to a network error. Attempting to
explicitly close a persistent connection will do nothing without
complaining.
-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--
Regards....

Nibin.

http://TechsWare.in
Stuart Dallas
2013-10-25 12:32:27 UTC
Permalink
Thank you for the quick response Stuart...one more doubt..at http://php.net/manual/en/features.persistent-connections.php they states
=========
This means that when the same client makes a second request to the server, it may be served by a different child process than the first time. When opening a persistent connection, every following page requesting SQL services can reuse the same established connection to the SQL server
=========
Is the persistent connection pool is re-used between apache child processes ?
No, connections are not shared between PHP processes. Nothing is shared between PHP processes.

-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
Post by Nibin V M
I have been reading docs and many are telling that persistent connections
are kept open indefinitely. But I found in PHP docs that it will not close
after script execution like requesting a page; so should it close after
the request is over?
So when exactly a persistent connection should close?
Please advice.
A persistent connection is closed when the PHP process ends, or it gets disconnected by the server-side or due to a network error. Attempting to explicitly close a persistent connection will do nothing without complaining.
-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--
Regards....
Nibin.
http://TechsWare.in
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Nibin V M
2013-10-25 12:33:23 UTC
Permalink
ok..thank you very much Stuart :)
Post by Nibin V M
Post by Nibin V M
Thank you for the quick response Stuart...one more doubt..at
http://php.net/manual/en/features.persistent-connections.php they states
Post by Nibin V M
=========
This means that when the same client makes a second request to the
server, it may be served by a different child process than the first time.
When opening a persistent connection, every following page requesting SQL
services can reuse the same established connection to the SQL server
Post by Nibin V M
=========
Is the persistent connection pool is re-used between apache child
processes ?
No, connections are not shared between PHP processes. Nothing is shared
between PHP processes.
-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
Post by Nibin V M
Post by Nibin V M
I have been reading docs and many are telling that persistent
connections
Post by Nibin V M
Post by Nibin V M
are kept open indefinitely. But I found in PHP docs that it will not
close
Post by Nibin V M
Post by Nibin V M
after script execution like requesting a page; so should it close
after
Post by Nibin V M
Post by Nibin V M
the request is over?
So when exactly a persistent connection should close?
Please advice.
A persistent connection is closed when the PHP process ends, or it gets
disconnected by the server-side or due to a network error. Attempting to
explicitly close a persistent connection will do nothing without
complaining.
Post by Nibin V M
-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--
Regards....
Nibin.
http://TechsWare.in
--
Regards....

Nibin.

http://TechsWare.in
Continue reading on narkive:
Loading...