I'm having a problem with curl in PHP that I can't figure out. I have a web server (Apache) that talks to a web service over HTTPS on another Apache server. We'll call them "server A" and "server B".
The problem I'm seeing is that server A only makes one connection at a time using curl to server B per browser that's connected to server A. I'm not sure if this is a curl or apache problem. I have seen references in several places to a max connection per server setting of one for a curl client but I can't verify that it exists.
Scenario:
AFAICT the requests are all serialized. I'm able to verify that multiple connections are open from browsers to server A, but only one https connection is open from A->B per browser connected to A.
Server B can handle many connections simultaneously but for some reason server A won't open multiple connections to server B. I have tried sending "Connection: close" from both servers A and B to see if that would help. It did not.
I have found lots of people talking about making multiple asynchronous connections per script but what I want to do is open multiple connections across different page instances to one external server.
Any ideas on what the problem is or how to fix it?
Native php sessions(files handler) use an exclusive locking model - only a single process/thread can work with the data for a specific session id at a time. When session_start() is called, execution will block until the process can acquire a lock on the session file. The lock is released when session_write_close() is called, which php automatically calls upon script termination. You can call it manually to release the lock and commit your changes. If desired, you can session_start() and session_write_close() multiple times per script execution.
Did you consider that server B allows only 1 secure connection ?
As i know this is a browser security issues that allows only 1 secure connection to same host at 1 time.