|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-04-16 18:32 UTC] 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. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 06:00:02 2025 UTC |
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.Maybe, old one was unclear, this the easiest way to reproduce this bug: <? if (fopen("http://www.cnn.com",r)) echo "OK"; ?> Online url: http://69.93.217.178/test.php If fails it shows: Warning: fopen(http://www.cnn.com): failed to open stream: HTTP request failed! in /home/homepage/public_html/test.php on line 2 If works shows: OK Please help. Best regards.I am having this problem as well. The interesting thing is that if I run: <? if (fopen("http://www.cnn.com",r)) echo "OK"; ?> Through a shell as root it works fine and returns ok, as well if I have fopen open a local file. Through my web browser using it to open a local file works as well and its only when its trying to open an outside connection that it hangs. This seems to indicate its a run/permission problem with apache maybe? Thanks, Ben W.Hello - Running FreeBSD 4.9,PHP4.3.6. I get the same errors, fopen causing segmentation fault, which then interrupts the browser's SSL connection. I have a script that thumbnails images on the fly. It's not all the time, but every once in a while, fopen will cause this error: [error] PHP Warning: fopen: failed to open stream: HTTP in /usr/local/www/site/phpthumb.php on line 615 which is reported in my apache error log for the virtual host. consequently, immediately after, in the apache error-log in apache root, this error occurs: child pid 43187 exit signal Segmentation fault (11) (note the PID # is always different as the apache processes recycle) The script file is 1200 lines long, I'm sure yuo dont want it all, but here is the area of line 615 as the error shows. The code `if ($fp = fopen($_REQUEST['src'], 'rb')) {` is line 615. FreeBSD 4.9 Apache/1.3.29 PHP/4.3.6 mod_ssl/2.8.16 OpenSSL/0.9.6g Am also running turck-mmcache 2.4.6 Please help with this. Am also more than willing to get you any info you need to help troubleshoot as fast as possible. <?php ob_start(); if ($fp = fopen($_REQUEST['src'], 'rb')) { $OriginalImageData = ''; do { $buffer = fread($fp, 8192); if (strlen($buffer) == 0) { break; } $OriginalImageData .= $buffer; } while (true); fclose($fp); } else { $fopen_error = ob_get_contents(); ob_end_clean(); if (ini_get('allow_url_fopen')) { ErrorImage('cannot open "'.$_REQUEST['src'].'" - fopen() said: "'.$fopen_error.'"'); } else { ErrorImage('"allow_url_fopen" disabled'); } } ob_end_clean(); ?>this has been happening to my site too. the following code errors, as does almost any use of file(),fopen(),file_get_contents() or readfile() on remote files. fsockopen seems to work for now though. <? // error'ing code $file = file("http://gerpok.darkflux.com/write.php"); if(strpos($file[0],"you don't")) { echo "not updated";} ?> and, whats more, after a recompile with --enable-debug, it is still error'ing. anything useful we can do with a debug build that errors on a regular basis?Have the same problem on FreeBSD 5.3 Release. + Apache 2.0.48 or 2.0.52 + PHP 4.3.8 + 4.3.9 + 4.3.10 --enable-debug doesn't solve the problem. Using --disable-all can't be done because this is a production host. It worked without any problems until last days. And right now fopen http doesnt work at all. Have tested the same on FreeBSD 4.9 + Apache 2.0.48 + PHP 4.3.10. Works correct with no problems. The server where we catch this bug hosts about 500 virtualhosts. code: <? $r = fopen("http://ya.ru","r"); fpassthru($r); fclose($r); ?> -- error: Warning: fopen(http://ya.ru/): failed to open stream: HTTP request failed! in /home/test/www/test2.php on line 6 -- Sometimes after "HTTP request failed!" there are some unreadable chars as "".