pfsockopen really keep the socket open when the script ends, allowing it to reuse the request from another, effectively opening fewer connections, as you would expect. However, this is not compatible with all SAPIs.
Persistence is found on the basis of each process . Thus, pfsockopen runs in the CLI. SAPI closes and reopens the socket at each execution, because the CLI script is executed in one running process, opens the socket and ends (closing the socket with the process).
In CGI mode with one process per script, this is also true.
When using Apache SAPI, it depends on what type of multiprocessor module (MPM) is used. mpm-prefork generates a new process with every request, so it most likely does not support it. mpm-worker , however, spawns threads, so it will probably work there. mpm-winnt is a version of Windows with multi-threaded MPM, so it should work too.
The worst fsockopen that the call will be executed as a normal fsockopen call.
source share