GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   PHP: something between 5.2.9 and 5.2.11 is causing connections to close prematurely? (https://gfy.com/showthread.php?t=940825)

rowan 11-29-2009 06:53 AM

PHP: something between 5.2.9 and 5.2.11 is causing connections to close prematurely?
 
I have a couple of sites that use URL fopen wrappers to fetch content remotely, and some others that do it at a more low level with fsockopen+fread. Works fine on a server with PHP 5.2.9, but after moving the sites to a server with PHP 5.2.11 I'm seeing data from outbound connections consistently truncated; it appears the connection is closing prematurely for some reason.

Downgrading to 5.2.9 on the new server seems to have fixed the problem.

Anyone else seen this? Remember it's for OUTBOUND connects initiated by a script. :error

nation-x 11-29-2009 07:04 AM

so are you making your fopen call the old way and looping through fgets?

calmlikeabomb 11-29-2009 07:13 AM

Have you tried alternative methods such as one of the following?

http://usphp.com/manual/en/class.httprequest.php
http://php.net/manual/en/book.curl.php

rowan 11-29-2009 07:17 AM

Quote:

Originally Posted by nation-x (Post 16596502)
so are you making your fopen call the old way and looping through fgets?

Yep, using while (!feof($fp)). Looks like that's the prob.

What's the "new" way to make the fopen call?

rowan 11-29-2009 07:18 AM

Quote:

Originally Posted by calmlikeabomb (Post 16596518)
Have you tried alternative methods such as one of the following?

http://usphp.com/manual/en/class.httprequest.php
http://php.net/manual/en/book.curl.php

My alternative method was to use $blah = `wget http://...`; :1orglaugh

(Ok, so I was desperate... and tired...)

TheDoc 11-29-2009 07:18 AM

Go with the alternative. Give Curl a try.

It's hard to guess... but it sounds like the data type/size maybe format, is causing you issues.

I have found curl to be extremely powerful and flexible... then again, I don't know sockets all that well.

nation-x 11-29-2009 07:57 AM

Quote:

Originally Posted by TheDoc (Post 16596524)
Go with the alternative. Give Curl a try.

It's hard to guess... but it sounds like the data type/size maybe format, is causing you issues.

I have found curl to be extremely powerful and flexible... then again, I don't know sockets all that well.

ditto... I have been using curl exclusively because it is just superior. The only issue is that you can't have open_basedir enabled.

TMM_John 11-29-2009 08:15 AM

curl is the way to go. So many more options and features.

k0nr4d 11-29-2009 08:28 AM

try executing a curl or wget process with nohup instead.

Other then that, check out fopen timeout settings in php.ini. The default setting might be different in different php versions

rowan 11-29-2009 08:58 AM

nation-x already nailed the prob, it's a PHP bug...

Killswitch - BANNED FOR LIFE 11-29-2009 09:15 AM

cURL ftw!

Iron Fist 11-29-2009 01:39 PM

cURL for the win... my host for instance, blocks fopen() by default (security measures)... so if a script uses fopen exclusively... I can't use it.

woj 11-29-2009 01:48 PM

bug or not, no one uses fopen for this kind of stuff... use curl instead, 10x more reliable.. :2 cents:


All times are GMT -7. The time now is 01:59 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123