title: Does php automaticly close the TCP connection after every request?
body: <p>I have Apache 2.4/PHP 5.6.13 running on Windows Server 2008 R2.</p>
  
  <p>I have an API connector which make 1 call per second per user to read a messaging queue.</p>
  
  <p>I am using <code>setInterval(...., 1000)</code> to make an ajax request to a handler which does the actual API call.</p>
  
  <p>The handler makes <code>cURL</code> calls to the API service to read the messaging queue.</p>
  
  <p>This works fine for 2 users but now I have 10 users using the system which mean more API calls being sent from my server.</p>
  
  <p>Many users "using the API caller or not" have been facing a timeout error. When I look at the php logs I see this fatal error</p>
  
  <pre><code>[14-Aug-2015 16:37:08 UTC] PHP Fatal error:  Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full.
  </code></pre>
  
  <p>I did a research on this issue and found out that it is not really a SQL error but rather a windows error. <a href="http://blogs.msdn.com/b/sql_protocols/archive/2009/03/09/understanding-the-error-an-operation-on-a-socket-could-not-be-performed-because-the-system-lacked-sufficient-buffer-space-or-because-a-queue-was-full.aspx" rel="nofollow">It is explained here.</a></p>
  
  <p>It seems to me that I will need to edit the Windows Registry to correct the issue as it is <a href="https://support.microsoft.com/en-us/kb/196271" rel="nofollow">explained here</a> but I don't like touching windows registry specially on a production server.</p>
  
  <p>My question is does PHP keep ths TCP connection open or does it close it after every request?</p>
  
  <p>I have 10 users using the "API caller" and about 200 that were not. This is only addition was 10 users/10 API calls per second.</p>
  
  <p>Assuming that PHP/cURL automaticly close the TCP connection, then how could I be reaching and 5000 connection from only 10 people using the API?</p>