Tuesday, June 2, 2009

Slow file_get_contents, fopen, wget, etc...?

Slow file_get_contents, fopen, wget, etc...?

Is this a home server, or is it in a datacenter? If it's at home, it's quite possible your router doesn't support IPv6, and that's slowing down the DNS.

try to enable IPv6 support for PHP

IPv6 Support enabled

Your DNS resolving is slow (the DNS your server is using can be a broblem, then most of the other domains could be slow) or your server has problems using the DNS cache.

There arent any better alternatives that are cheaper, however i use iworx (www.interworx.com) however its meant for a bit more... experienced server admin.

Anyways, your issue isnt php or apache at all, its your DNS.

Make sure you have your DNS set up properly. This means having your hostname resolved properly and so on. Also, remember that most servers have ICMP requests blocked, to stop pingfloods (the older form of DoS attack) from occuring.

Furthermore, you'll want to make sure that EVERYTHING is configured for both backwards and forwards resolution on your DNS server.

Dedicated servers arent for the faint of heart and usually require quite a bit of initial configuration to get things going properly.

A lot of dedicated server offerings have the host providing some sort of DNS service for you, if you are not really all that DNS educated.

There are quite a few pretty extensive DNS tutorials out there.

And just FYI, the reason this sort of thing occurs is because your box has multiple IP addresses assigned to it by the DHCP server at your dedicated host, and when the server goes to do something it doesnt know what to do because its hostname (the local name for the computer) is trying to use an ip address and it doesnt know what its own IP address is due to multiple ip addresses on the same interface.

Essentially, its like having 5 phone numbers on the same phone line connected to the same line number and trying to dial out. It wont work.

No comments: