View Full Version : Default stream timeout

06-22-2010, 01:04 AM
Hey guys, I have a short and hopefully simple question. I know that there is a default_socket_timeout parameter in php.ini that specifies the maximum time for opening a socket.
I also know that the timeout for streams can be set with stream_set_timeout. Is there a default value for the timeout of a stream and if so, what is it and can it be set in php.ini?

Thanks in advance.

06-22-2010, 04:24 PM
I believe that any socket based stream will take the timeout enforced by the default_socket_timeout, but offhand I've never tried this so I cannot verify.
Ah, here's a list of them too: http://php.net/manual/en/transports.php

So, I believe if you have set up a stream using any of the layers used in the above link, that those are all considered to be socketed streams and will take the default_socket_timeout. If not, they will of course be terminated by your max execution time instead.
This smells like something that needs a test. Sadly, the api isn't overly clear about this (or could just be listed where I wouldn't think to look :P).

06-24-2010, 01:05 AM
Thanks! I assumed the same but, as you say, the documentation is not clear about this. It is strange that this is not better documented, since this seems quite important.

06-24-2010, 04:04 PM
I have to agree. Unless I'm totally out to lunch on that, I would expect that there be an entry within the streams section indicating if there is a default timeout, and if there is how its enforced. I make the assumption its the same as with the sockets for socketed streams, but we shouldn't have to make this assumption.