Re: [PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-30 Thread Richard Lynch
DNS records are failing to lookup the domain name for you...

Maybe just put the URL back into a queue to try later.

You should also toy with nslookup or dig from the command line and see
if you can get it to fail as often.

On Thu, December 27, 2007 12:00 pm, Albert Wiersch wrote:

 Some additional info. It seems I am getting these warnings when it
 fails:

 Warning: fopen() [function.fopen]: php_network_getaddresses:
 getaddrinfo
 failed: Name or service not known

 Warning: fopen(http://wanganda2u.co.uk) [function.fopen]: failed to
 open
 stream:

 Now I have to find out why that is failing some of the time but not
 other
 times.

 --
 Albert Wiersch
 Fix your website: http://onlinewebcheck.com


 Albert Wiersch [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]

 I noticed my script at http://onlinewebcheck.com was sometimes
 (fairly
 often) failing to open some URLs that users have entered. fopen()
 returns
 false very quickly, but when tried again with the same URL,
 sometimes it
 works. What would cause this behavior? Why does fopen() occasionally
 fail
 to open valid http addresses but works at other times?

 --
 Albert Wiersch

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-30 Thread Richard Lynch
If it's a busy server, you may be running out of TCP connections...

If PHP can't open ANY connection at all, it can't do a DNS lookup, and
it would fail very fast, as it's hitting an OS limit/cap on the number
of connections and not even getting to try to talk to the Internet.

On Fri, December 28, 2007 12:03 pm, Albert Wiersch wrote:
 I'm now using PHP 5.2.5.

 Well, it seems to still be happening. This describes the problem but I
 haven't found a solution that works for me yet:
 http://bugs.php.net/bug.php?id=11058

 Is it a PHP problem or DNS? It works sometimes but not other
 times..
 something strange is going on.

 Example messages:
 [Fri Dec 28 11:59:04 2007] [error] [client 192.168.0.51] PHP Warning:
 fopen() [a href='function.fopen'function.fopen/a]:
 php_network_getaddresses: getaddrinfo failed: Name or service not
 known
 [Fri Dec 28 11:59:04 2007] [error] [client 192.168.0.51] PHP Warning:
 fopen(http://www.lantanalinks.com) [a
 href='function.fopen'function.fopen/a]: failed to open stream:
 Success

 I suppose I could adjust the script to try again if it fails the first
 time,
 but I shouldn't have to.

 Some additional info, when it fails with this problem, it fails very
 quickly
 (in less than half a second)... its like it doesn't even try to look
 up the
 name.

 --
 Albert Wiersch
 Fix your website: http://onlinewebcheck.com


 Albert Wiersch [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]

 I noticed my script at http://onlinewebcheck.com was sometimes
 (fairly
 often) failing to open some URLs that users have entered. fopen()
 returns
 false very quickly, but when tried again with the same URL,
 sometimes it
 works. What would cause this behavior? Why does fopen() occasionally
 fail
 to open valid http addresses but works at other times?

 --
 Albert Wiersch

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-29 Thread Albert Wiersch

Dan [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

 You really need to filter your input more, have a list of what is 
 acceptable not what is unacceptable.  That being, make it a requirement 
 that the url input has a TDL(.com, .net, .org, etc.) or is a valid IP(ping 
 it), only allow alphanumerics for the name, etc.  When you don't validate 
 your site can get hacked, I know it's not really insecure but it's just an 
 example of input you may not expect, if you try to validate 
 http://localhost it goes ahead and validates your server's html.

I make sure it starts with http: or https: and change spaces to %20 so 
it will work. I also check for some possible recursion issues. I think I'm 
fairly secure just doing that. What could happen security wise? What else do 
you think I need to do? I don't want to check for a TLD as there are many 
and I don't think it is necessary... and pinging doesn't seem like a good 
idea either as some servers probably won't respond to pings.

The localhost issue is interesting, but I don't see it as a security issue.

I would like to know if there are any serious secirity issues I may be 
overlooking though.

Thanks,
Albert

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-28 Thread Albert Wiersch
I'm now using PHP 5.2.5.

Well, it seems to still be happening. This describes the problem but I 
haven't found a solution that works for me yet:
http://bugs.php.net/bug.php?id=11058

Is it a PHP problem or DNS? It works sometimes but not other times.. 
something strange is going on.

Example messages:
[Fri Dec 28 11:59:04 2007] [error] [client 192.168.0.51] PHP Warning: 
fopen() [a href='function.fopen'function.fopen/a]: 
php_network_getaddresses: getaddrinfo failed: Name or service not known
[Fri Dec 28 11:59:04 2007] [error] [client 192.168.0.51] PHP Warning: 
fopen(http://www.lantanalinks.com) [a 
href='function.fopen'function.fopen/a]: failed to open stream: Success

I suppose I could adjust the script to try again if it fails the first time, 
but I shouldn't have to.

Some additional info, when it fails with this problem, it fails very quickly 
(in less than half a second)... its like it doesn't even try to look up the 
name.

-- 
Albert Wiersch
Fix your website: http://onlinewebcheck.com


Albert Wiersch [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

 I noticed my script at http://onlinewebcheck.com was sometimes (fairly 
 often) failing to open some URLs that users have entered. fopen() returns 
 false very quickly, but when tried again with the same URL, sometimes it 
 works. What would cause this behavior? Why does fopen() occasionally fail 
 to open valid http addresses but works at other times?

 -- 
 Albert Wiersch 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-28 Thread Wolf
DNS issues

Albert Wiersch wrote:
 I'm now using PHP 5.2.5.
 
 Well, it seems to still be happening. This describes the problem but I 
 haven't found a solution that works for me yet:
 http://bugs.php.net/bug.php?id=11058
 
 Is it a PHP problem or DNS? It works sometimes but not other times.. 
 something strange is going on.
 
 Example messages:
 [Fri Dec 28 11:59:04 2007] [error] [client 192.168.0.51] PHP Warning: 
 fopen() [a href='function.fopen'function.fopen/a]: 
 php_network_getaddresses: getaddrinfo failed: Name or service not known
 [Fri Dec 28 11:59:04 2007] [error] [client 192.168.0.51] PHP Warning: 
 fopen(http://www.lantanalinks.com) [a 
 href='function.fopen'function.fopen/a]: failed to open stream: Success
 
 I suppose I could adjust the script to try again if it fails the first time, 
 but I shouldn't have to.
 
 Some additional info, when it fails with this problem, it fails very quickly 
 (in less than half a second)... its like it doesn't even try to look up the 
 name.
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-28 Thread Albert Wiersch

Wolf [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 DNS issues

I think I've solved this. I found a problem with resolv.conf that contained 
some outdated DNS servers. After changing that and rebooting the server it 
seems to be working. It didn't seem to work after just changing the file and 
restarting apache though, it seems like the reboot was necessary. I don't 
know why but so far do good.

The root.hints file was also updated. I'm not sure if that had anything to 
do with it but it was updated in the process of trying to fix the problem.

Albert 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-28 Thread Dan
Albert Wiersch [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]


I noticed my script at http://onlinewebcheck.com was sometimes (fairly 
often) failing to open some URLs that users have entered. fopen() returns 
false very quickly, but when tried again with the same URL, sometimes it 
works. What would cause this behavior? Why does fopen() occasionally fail 
to open valid http addresses but works at other times?


--
Albert Wiersch


You really need to filter your input more, have a list of what is acceptable 
not what is unacceptable.  That being, make it a requirement that the url 
input has a TDL(.com, .net, .org, etc.) or is a valid IP(ping it), only 
allow alphanumerics for the name, etc.  When you don't validate your site 
can get hacked, I know it's not really insecure but it's just an example of 
input you may not expect, if you try to validate http://localhost it goes 
ahead and validates your server's html.


- Dan 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-27 Thread Albert Wiersch

Some additional info. It seems I am getting these warnings when it fails:

Warning: fopen() [function.fopen]: php_network_getaddresses: getaddrinfo 
failed: Name or service not known

Warning: fopen(http://wanganda2u.co.uk) [function.fopen]: failed to open 
stream:

Now I have to find out why that is failing some of the time but not other 
times.

-- 
Albert Wiersch
Fix your website: http://onlinewebcheck.com


Albert Wiersch [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

 I noticed my script at http://onlinewebcheck.com was sometimes (fairly 
 often) failing to open some URLs that users have entered. fopen() returns 
 false very quickly, but when tried again with the same URL, sometimes it 
 works. What would cause this behavior? Why does fopen() occasionally fail 
 to open valid http addresses but works at other times?

 -- 
 Albert Wiersch 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-27 Thread Daniel Brown
On Dec 27, 2007 1:00 PM, Albert Wiersch [EMAIL PROTECTED] wrote:

 Some additional info. It seems I am getting these warnings when it fails:

 Warning: fopen() [function.fopen]: php_network_getaddresses: getaddrinfo
 failed: Name or service not known

That sounds like a DNS resolution error.  If you have Telnet/SSH
or local console access, try doing a dig, traceroute, and ping series
on it.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-27 Thread Albert Wiersch

Daniel Brown [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

That sounds like a DNS resolution error.  If you have Telnet/SSH
 or local console access, try doing a dig, traceroute, and ping series
 on it.

Hi Daniel,

Yes, I have SSH access. I will keep that in mind. Upgrading to 5.2.5 may 
have addressed this issue though. If not, then I'll concentrate on a 
possible DNS resolution problem.

Albert

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-27 Thread Albert Wiersch

Albert Wiersch [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

 Yes, I have SSH access. I will keep that in mind. Upgrading to 5.2.5 may 
 have addressed this issue though. If not, then I'll concentrate on a 
 possible DNS resolution problem.

Well, it seems to still be happening. This describes the problem but I 
haven't found a solution that works for me yet:
http://bugs.php.net/bug.php?id=11058

Is it a PHP problem or DNS? It works sometimes but not other times.. 
something strange is going on.

Albert

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php