首页 > stream_set_timeout 设置超时无效 fread依然超时

stream_set_timeout 设置超时无效 fread依然超时

接口超时502 bad gate way

超时限制失效

页面调用接口的时候,响应10s。通过使用xhprof监控,发现是调用接口超时。但是实际上接口超时的时候最多只允许2s,通过stream_set_timeout进行了读流超时限制。

查询手册

手册中有一些例子,其中有一段是这样说的:

If you are using fsockopen() to create a connection, first going to write into the stream and then waiting for the reply (e.g. simulating HTTP request with some extra headers), then stream_set_timeout() must be set only after the write - if it is before write, it has no effect on the read timeout :-( 

但是实际上,按照这种写法进行了逻辑修改,依然是无效的。

我改怎么解决这个问题呢?

【热门文章】
【热门文章】