Having problems browsing themes, uploading plug-ins, or doing just about anything that “talks” to the outside world via WordPress? We have had a development server buried deep in our network behind several routers and firewalls that had a similar problem. Whenever we’d log into the dashboard we’d get various timeout error messages on each of the news sections. We’d not get our automatic update messages whenever there was a plugin update or a WordPress update (3.0 is coming soon!).
Well it turns out that we needed to fix 2 things to help speed up the network connection.
Fix #1 – DNS Resolution
We run this particular development box on Linux. That meant updating our /etc/resolv.conf file to talk directly to the DNS servers. If you use DHCP configuration or go through a router this file is often empty. Force-feeding our Internet Service Providers (ISPs) DNS server IP addresses into this file sped up domain name lookups significantly. This meant looking up things on wordpress.org took 1-2 seconds versus the previous 10-20 second lookup times. Here is what we put in our file for our Bellsouth/AT&T DNS in Charleston South Carolina:
search cybersprocket.com nameserver 184.108.40.206 nameserver 220.127.116.11 nameserver 192.168.3.254
Fix # 2 – Adjust PHP Timeout
This seemed to help with the problem, though we’re not sure why. WordPress should be overriding the default PHP.ini settings but maybe something was missed deep in the bowels of the WordPress codebase… either that or this was pure coincidence. Either way, we’re listing it here because as soon as we did these two things our timeout issues went away.
Update php.ini, on our linux server this is /etc/php.ini, and change the default_socket_timeout setting to 120. That section of our php.ini now looks like this:
; Default timeout for socket based streams (seconds)
;default_socket_timeout = 60
default_socket_timeout = 120
Hopefully these notes will help you resolve any timeout issues you’re having with your WordPress site.