ID: 22297 User updated by: sp at m-me dot dk Reported By: sp at m-me dot dk -Status: Feedback +Status: Open Bug Type: Filesystem function related Operating System: Windows PHP Version: 4.3.2-dev New Comment:
Using 127.0.0.1 instead of localhost had no effect. The script still took "2 * default_socket_timeout" seconds. The var_dump(gethostbynamel("localhost")); returned (with no delay): -------------------------------------------------------- array(1) { [0]=> string(9) "127.0.0.1" } -------------------------------------------------------- Previous Comments: ------------------------------------------------------------------------ [2003-02-21 05:13:21] [EMAIL PROTECTED] Could you also paste the output of this script: <?php var_dump(gethostbynamel("localhost")); ?> ------------------------------------------------------------------------ [2003-02-21 05:00:06] [EMAIL PROTECTED] Can you try using "127.0.0.1" instead of "localhost" in your script? If that fixes it for you, I will add equivalent code into the PHP core itself (when running under windows). ------------------------------------------------------------------------ [2003-02-20 19:31:47] sp at m-me dot dk [EMAIL PROTECTED] writes: "Your system has determined two alternative addresses to attempt to contact for localhost and it attempts each alternative for default_socket_timeout in seconds." I'm not into how the file() function tries to read an URL, but after what [EMAIL PROTECTED] writes it seems that it tries a couple of different methods for reading the URL if the previous ones does not work. For me it looks like the first 2 does not work, but the 3th does. If that is right it then makes sense that the "max_execution_time" has to be larger than "2 * default_socket_timeout" (because the first two tries have to time out fist).. ------------------------------------------------------------------------ [2003-02-20 19:20:47] sp at m-me dot dk I did a little test to try to find out when the script fails. It looks like the script fails everytime the "max_execution_time" is smaller than "2 * default_socket_timeout". max_execution_time default_socket_timeout output ------------------------------------------------------ 60 10 no error 25 10 no error 22 10 no error 21 10 no error 20 10 error 15 10 error 10 10 error 5 10 error (when I write "no error" the script still runs for "2 * default_socket_timeout" seconds though) ------------------------------------------------------------------------ [2003-02-20 19:02:57] sp at m-me dot dk The script supplied gives the right output, but still takes "default_socket_timeout * 2" seconds. I found that if I removed the first line "set_time_limit(600);" the script faild again - Still I could not get rid of the long timeout. The output from the code was: -------------------------------------------------- array(1) { [0]=> string(6) "foobar" } array(9) { [0]=> string(15) "HTTP/1.1 200 OK" [1]=> string(35) "Date: Fri, 21 Feb 2003 00:43:31 GMT" [2]=> string(29) "Server: Apache/2.0.43 (Win32)" [3]=> string(44) "Last-Modified: Tue, 18 Feb 2003 15:48:22 GMT" [4]=> string(23) "ETag: "37a6-6-d5528ab3"" [5]=> string(20) "Accept-Ranges: bytes" [6]=> string(17) "Content-Length: 6" [7]=> string(17) "Connection: close" [8]=> string(44) "Content-Type: text/plain; charset=ISO-8859-1" } -------------------------------------------------- The output from the curl command (had to install Cygwin) was: -------------------------------------------------- $ curl -i http://localhost/test/readfile/test.txt HTTP/1.1 200 OK Date: Fri, 21 Feb 2003 00:41:16 GMT Server: Apache/2.0.43 (Win32) Last-Modified: Tue, 18 Feb 2003 15:48:22 GMT ETag: "37a6-6-d5528ab3" Accept-Ranges: bytes Content-Length: 6 Content-Type: text/plain; charset=ISO-8859-1 foobar -------------------------------------------------- ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/22297 -- Edit this bug report at http://bugs.php.net/?id=22297&edit=1