views:

20

answers:

0

I'm writing a PHP site which connects to a Java server to get data. It does this via a socket. To improve performance I'd like to use pfsockopen() to connect to the server, so a new connection (with costly handshake) doesn't have to be opened for every request.

What I can't find in the documentation though, is this thread safe? If PHP is executed in multiple threads, does each thread get its own socket? I'll probably be running PHP as Apache module or as FastCGI.