How to Fix “Connection Timed Out in WordPress”

If you’re a WordPress user with, at least, a few months of shared hosting experience, you might notice error messages like “connection timed out“. That’s a problem that causes lots of other issues, especially, if you have a membership website.

That error message will display when you reach all your server resources and memory usage. But, you will not get a regular notification that really the server can’t handle any extra executions.

The problem itself, can’t give the exact locations where you need to fix things. But, the general idea is that the server is not able to receive or execute any other request from web browsers, or, from your plugins or themes.

If you’re using Cloudflare for example, the error is the same as the above, but with code 522 that means the server is not responding for a long time.

Like any other problem on the web, there are solutions and you can start applying them one by one if you’re not sure which method will work for you.

If you’ve tried to increase the memory limit, that will solve the problem only, if you’re hosting your WordPress blog or website with a powerful hosting company.

In other cases, where you’re using shared hosting, the memory limit increase will not solve the connection errors, in general. That’s simply because the resources are shared, and if it works now, it will return again later, and so on.

So, first, if you really want to forget these errors completely, you need to use an optimized WordPress hosting service with powerful resources. I recommend the premium WP Engine, as they’re the leaders in the premium and managed WordPress hosting industry.

Also, if you use a CDN, you’ll speed up your site naturally, and also, you will save lots of resources and the execution time will be faster. I only recommend MaxCDN as the real and the most secure platform.

Fixing the WordPress connection timed out error

Now, let’s fix the problem in the shared hosting environments, especially.

1. Increasing the maximum execution time

We will try to increase the execution time in your server, it’s the first thing to verify, as the error talks about the time in the connection. That means probable issues with the maximum execution time. The first thing that you need is the “php.ini” file in your server.

Related:  How to Link a CDN to WordPress without a Caching Plugin

Please remember, WordPress will not add this file to your blog. It’s the server configuration and the hosting company is the only one who can manage that file, and let their customers edit it or not. If you find the file, but you can’t edit it, then, you need to contact your hosting customer support. Then, and ask them to increase your maximum memory limit.

If you’re able to find the php.ini file and you can edit its content, then, add the following code and save it.

max_execution_time = 60 ;

The second option is to edit the “htaccess” file. If you can’t find that file, you can create it by yourself, all you have to do is to create a new file named “.htaccess”. Then, update your permalinks to let WordPress regenerate its engine code automatically.

If you have already an “htaccess” file like the majority of sites, then, you can add the following code to increase the maximum execution time which’s 30 seconds by default.

php_value max_execution_time 60

Of course, you need to save the file after making the changes. This will fix the problem if the server can handle more requests, but the limited execution time is what’s causing the problem.

Connection Timed Out in WordPress

2. Deactivate WordPress plugins

When you have lots of plugins and, especially, the ones with lots of PHP request to your server, it becomes critical, sometimes to execute and respond to all these thousands of requests. So, make sure to disable all your plugins at once, from your WordPress dashboard. That will let you verify if you have things to correct with your plugins or not.

Reactivate your plugins one by one, until you find the exact one that has the problem. Then, delete it, or search for an alternative tool. If you’re using plugins that you need once a week, for example, then, deactivating them will be better.

If you can’t access your admin area and you can’t activate or disable plugins, then, you can disable them from your cPanel, by renaming each plugin. For example, add “off” to the end of all your plugin names. That will disconnect them from WordPress, and they will no longer work until you remove that “off” at the end.

Related:  Best WordPress Plugin for SEO: Optimize your Content for Search Engines

Example:

Find your plugins folder in “wp-content/plugins”, then rename the plugin “Akismet”, for example, to “AkismetOff” and repeat that for all the others. Then, test your site when you reactivate every single plugin by deleting the “off”.

3. Increase the PHP allocated memory

The maximum memory allocated on shared hosting servers makes things limited. So, no more PHP executions if you reach your limit. In some cases, you get a connection timed out error and not a memory size error message.

To increase your maximum PHP limit, you need to add the following code to your “wp-confing.php” file.

define( 'WP_MEMORY_LIMIT', '64M' );

This will work only if you’re allowed to increase the memory limit. Some hosting companies will close the doors to their users to allocate more memory. In that case, you should contact them and ask to allow your site more memory.

4. Verify your WordPress theme

In other cases, the theme can be the problem if it sends lots of requests, and it’s not well coded with the minimum optimization.

It’s a simple thing that you switch to another theme, or simply, to use one of the default WordPress themes, then, verify if things work properly.

Also, you can scan your theme for malware if you’re not sure about its source. That’s another thing that you should avoid, free themes cause lots of problems and can destroy websites.

5. Check your server file compression

This is another rare case that can fix the problem if you have a big number of requests to your server. You can compress the HTML  and text files, which will reduce the number of requests from the web browser to the server.

Conclusion

These are the things to verify when you have timed out error messages in general, and in WordPress especially. WordPress needs lots of resources and that’s why optimized WordPress hosting becomes popular and a need in the last years. The huge number of PHP executions and requests will never work with a classic hosting environment.

Avatar for Fathi Arfaoui
About Fathi Arfaoui

Fathi Arfaoui is a Physicist, Blogger and the founder of Trustiko.com. He shares Business, WordPress and Blogging tips to build a better blog and succeed online.

Disclosure: The recommendations on this page are my own based on my tests and analysis. We may earn a small commission from web hosts and other partners if you use my referral link to make a purchase. That’s what helps us to maintain the site and add fresh content, Thanks for your support.

Leave a Comment