ID: 28029 User updated by: coadmin at hostings dot pl Reported By: coadmin at hostings dot pl Status: Open Bug Type: URL related Operating System: FreeBSD 4.9 and 5.2.1 PHP Version: 4CVS-2004-04-16 (stable) New Comment:
inessential, my solution was wrong. this is not it. please make your investigations into this problem. thanks. Previous Comments: ------------------------------------------------------------------------ [2004-04-17 20:53:19] coadmin at hostings dot com dot pl Please hold one for one day, maybe I've solution. I must test it. I will write what about it in 24h. Regards. ------------------------------------------------------------------------ [2004-04-17 19:15:59] coadmin at hostings dot pl It's code of PHP script which make error [2]. $check is delivered by POST method from HTML form. sprawdz.php: <? $id = 1111; $code = "x,x,x,x,x"; $type = "sms,c1"; $handle = fopen("http://allpay.pl/check_code.php?id=".$id."&code=".$code."&c heck=".$check."&type=".$type."", 'r'); $status = fgets($handle, 8); $czas_zycia = fgets($handle, 24); fclose($handle); $czas_zycia = rtrim($czas_zycia); if ($status == 0) {print "pass is bad - try again"; exit;} else { # if pass is good: if (!isset($_COOKIE['ActiveCode'])) { setcookie('ActiveCode',1, time()+$czas_zycia); } else { setcookie('ActiveCode',0, time()+2, "/"); setcookie('ActiveCode',1, time()+$czas_zycia, "/"); } header("Location: index1.php"); } ?> full error: Warning: fopen(http://allpay.pl/check_code.php?id=1111&code=x,x,x,x,x&check=yourpassword8&type=sms,c1): failed to open stream: HTTP request failed! AeáW in /home/prospl/public_html/sprawdz.php on line 20 Warning: fgets(): supplied argument is not a valid stream resource in /home/prospl/public_html/sprawdz.php on line 21 Warning: fgets(): supplied argument is not a valid stream resource in /home/prospl/public_html/sprawdz.php on line 22 Warning: fclose(): supplied argument is not a valid stream resource in /home/prospl/public_html/sprawdz.php on line 23 line in error (20) is: "$handle = fopen("http://......" Online URL: http://www.pros.pl/ (it is working now) Form is from the left side with button "Wchodze do bazy". You could give any password there. It should shows "Kod niepoprawny - wpisz ponownie." - it means bad password. If fails, is timeout and it shows error message as above. IMHO, there aren't any mistakes in php code, the problem is to open sockets with "http://" url. I'll provide GDB backtrace asap. I'm not sure if it will be possible, because PHP still works, and there aren't any crashes. Crash was my word to describe that these functions stopped to work. ------------------------------------------------------------------------ [2004-04-16 22:05:25] [EMAIL PROTECTED] Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try avoid embedding huge scripts into the report. And also a GDB backtrace of the crash. (configure with --enable-debug!) ------------------------------------------------------------------------ [2004-04-16 18:32:21] coadmin at hostings dot pl Description: ------------ PHP randomly crashes(?) and some functions couldn't open HTTP connection. I found these are bad: getimagesize() fopen() fsockopen() and others... I checked two different servers with different hardware and different systems: FreeBSD 4.9-STABLE and FreeBSD 5.2.1-p3. I checked following PHP versions: 4.3.3, 4.3.4, 4.3.5, 4.3.6, 4.3.7-dev. All are affected. Apache version is 1.3.29. PHP is compiled as mod_php. Reproduce code: --------------- URL requests crashes about a few minutes to a few hours after starting apache. Apache restart is helpfull and make functions working again for next a few hours. After it is the same, next restart, works for some time, and the same... During crash others PHP functions works well. Actual result: -------------- Sample logs: [1] PHP Warning: getimagesize(http://foo.com/image.jpg): failed to open stream: HTTP request failed! ^L°^R^A in /home/foo/public_html/index.php on line 1053 [2] PHP Warning: fopen(http://foo.com/check.php?id=111&code=xxx): failed to open stream: HTTP request failed! @Áå^L in /home/foo/public_html/check.php on line 19 [3] PHP Warning: copy(http://foo.com/file.php?board=2700&zip=1): failed to open stream: HTTP request failed! ^LpLÒ^K in /home/foo/public_html/zip.php on line 44 And many others... I'm always receiving strange code after the "HTTP request failed!" info. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28029&edit=1