Forum Moderators: coopster

Message Too Old, No Replies

fopen problem with urls

         

jojy

2:38 pm on Dec 7, 2008 (gmt 0)

10+ Year Member



Hello,
I have two identical servers except apache, one has apache 1.x and other one has apache 2.

fopen works fine on apache 1.x server but on apache2 it takes up to 25 secs.

Basically I want to run google mobile ads and it uses fopen, it takes 25 secs to load an ad. I have used fopen('http://www.yahoo.com','r') to see if there is anything wrong with google but this one also takes same time on apache2 and it works fine on apache 1.x server.. I am wondering if apache is causing this problem?

I have checked php settings everything is 100% same. Please suggest me if you ever run into this kind of problem.

Thanks

coopster

7:32 pm on Dec 8, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Are both servers behind the same firewalls, etc too? Apache 2 should be no different than Apache 1 when it comes to remote url retrieval using fopen as far as performance goes.

jojy

7:40 pm on Dec 8, 2008 (gmt 0)

10+ Year Member



yes both have same firewall, I even disabled firewall but nothing happened

janharders

12:48 am on Dec 16, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



apache shouldn't be the prime suspect here, I'm guessing you run different php-versions? Are the name servers for both systems the same?
Does the result show up correctly after the 25 seconds?
does lynx (or wget or some other commandline client) show the same behaviour on the "slow" server?
You could do a
flush();
after your script outputs stuff based on the fopen-result to see if your output is just beeig buffered. are you sure that it's the line where you fopen an url (which isn't that good, btw, it's much better to use a http-capable client-package which will let you react to errors etc, try curl or one of the pear-packages).

jojy

1:08 am on Dec 16, 2008 (gmt 0)

10+ Year Member



janharders, I already wrote I have same php version and now I down graded apache to 1.3 but still no luck. I am 100% sure its fopen because I am tracking time.. on the top of fopen statement and below of it. I am using exact code on both servers and few expert system administrators already have given try but no luck :(

its strange problem so far now I faced!

janharders

1:11 am on Dec 16, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



is the time it takes more or less the same or is it anything up to 25 seconds?
name servers are the same?

jojy

1:20 am on Dec 16, 2008 (gmt 0)

10+ Year Member



name servers are different.. time takes 0 sec before fopen calls and after it takes approx 16-17 secs. If I run script without fopen then it takes 0.1 seconds so it appears my mobile script is fine and server also. CURL works fine on the server but google mobile ads don't support it.

janharders

1:29 am on Dec 16, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



mh, sound's like a hard case. have you tried to access a page that is on a server which does not require a host, just requesting the page on a specific IP (try one of google's for example), just to make sure it's not a strange php-dns-interaction-problem?

Maybe try to change the php-version - did you compile php yourself or do you use a precompiled version? what OS are the servers running on, are the OS-versions of both server the same?
you might have tripped on a hard-to-locate bug in php, if your sysadmins failed, maybe it's time to build a very lightweight testscript and seek support from the php-devs ...

jojy

1:51 am on Dec 16, 2008 (gmt 0)

10+ Year Member



yup, accessed from shell php -q /path/to/page.php takes same time , both server have centos and php 5.2.6. I have php compiled version not precompiled and both have same configuration. Can't downgraded or upgrade php on server because its production server :( badly stuck on this small problem