3

This is what the PHP Documentation has to say on Connection Pooling:

The mysqli extension supports persistent database connections, which are a special kind of pooled connections.

and

Every PHP process is using its own Mysqli connection pool.

But do child processes (after a fork()) share the same connection pool?

Therefore, is a permanent database connection avoiding that one child closes another child's connection?

Andy
  • 4,783
  • 2
  • 26
  • 51

1 Answers1

0

Read this chapter about mysqli and persistent connections on the official PHP site. Normally a forked child process will share its parents' file-descriptors (which sockets are) so theoretically the answer is yes.

Therefore, is a permanent database connection a solution for the Server has gone away problem?

You will have to try, this error can happen under a variety of circumstances.

thwd
  • 23,956
  • 8
  • 74
  • 108
  • My children are each opening a permanent connection — so if they use the same pool, most of them should use the same connection and not close any — right? – Andy Jun 24 '12 at 12:08
  • Eventually a child might be forced to close a broken socket but normally your child processes can pool on the same group of sockets. – thwd Jul 12 '12 at 21:31