Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 11-29-2009, 06:53 AM   #1
rowan
Too lazy to set a custom title
 
Join Date: Mar 2002
Location: Australia
Posts: 17,393
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.
rowan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-29-2009, 07:04 AM   #2
nation-x
Confirmed User
 
nation-x's Avatar
 
Industry Role:
Join Date: Mar 2004
Location: Rock Hill, SC
Posts: 5,370
so are you making your fopen call the old way and looping through fgets?
nation-x is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-29-2009, 07:13 AM   #3
calmlikeabomb
Confirmed User
 
calmlikeabomb's Avatar
 
Join Date: May 2004
Location: SW Palm Bay, Florida
Posts: 1,323
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
__________________
subarus.
calmlikeabomb is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-29-2009, 07:17 AM   #4
rowan
Too lazy to set a custom title
 
Join Date: Mar 2002
Location: Australia
Posts: 17,393
Quote:
Originally Posted by nation-x View Post
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 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-29-2009, 07:18 AM   #5
rowan
Too lazy to set a custom title
 
Join Date: Mar 2002
Location: Australia
Posts: 17,393
Quote:
Originally Posted by calmlikeabomb View Post
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://...`;

(Ok, so I was desperate... and tired...)
rowan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-29-2009, 07:18 AM   #6
TheDoc
Too lazy to set a custom title
 
TheDoc's Avatar
 
Industry Role:
Join Date: Jul 2001
Location: Currently Incognito
Posts: 13,827
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.
__________________
~TheDoc - ICQ7765825
It's all disambiguation
TheDoc is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-29-2009, 07:57 AM   #7
nation-x
Confirmed User
 
nation-x's Avatar
 
Industry Role:
Join Date: Mar 2004
Location: Rock Hill, SC
Posts: 5,370
Quote:
Originally Posted by TheDoc View Post
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.
nation-x is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-29-2009, 08:15 AM   #8
TMM_John
Confirmed User
 
TMM_John's Avatar
 
Industry Role:
Join Date: May 2004
Posts: 6,660
curl is the way to go. So many more options and features.
TMM_John is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-29-2009, 08:28 AM   #9
k0nr4d
Confirmed User
 
k0nr4d's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,228
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
k0nr4d is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-29-2009, 08:58 AM   #10
rowan
Too lazy to set a custom title
 
Join Date: Mar 2002
Location: Australia
Posts: 17,393
nation-x already nailed the prob, it's a PHP bug...
rowan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-29-2009, 09:15 AM   #11
Killswitch - BANNED FOR LIFE
Guest
 
Posts: n/a
cURL ftw!
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-29-2009, 01:39 PM   #12
Iron Fist
Too lazy to set a custom title
 
Join Date: Dec 2006
Posts: 23,400
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.
__________________
i like waffles
Iron Fist is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-29-2009, 01:48 PM   #13
woj
<&(©¿©)&>
 
woj's Avatar
 
Industry Role:
Join Date: Jul 2002
Location: Chicago
Posts: 47,882
bug or not, no one uses fopen for this kind of stuff... use curl instead, 10x more reliable..
__________________
Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager
woj is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.