UPDATED: Thanks, found the cause: gethostbyname takes a lot of time. Thread should be closed. Hello, I have a piece like this $f=fsockopen($ip, $port, $errno, $errstr, $timeout); I set $timeout=3, but sometimes fsockopen doesn't timeout. It hangs until the connection is created, and takes about 5 - 25 seconds. I already set the default_socket_timeout=3 using ini_set(); Can you guys help me please