Scanning all records in a set

Could be the PHP client and your code is taking too much time to process and causing the socket to timeout.

With server 3.14, you should be able to set the socket timeout for scan. This is possible since version 3.12.1:

[AER-5510] - (SCAN) Write idle-time-out now configurable from client.

I am not sure if the PHP client supports setting this property on scan, but I would hope it does. Otherwise, you typically have only a 10 second timeout at the socket level after which the server will close the connection. I believe this is different than the read timeout you are passsing. (You can confirm this is happening by checking the server side logs).