How to Fix the 504 Gateway Timeout Error in WordPress?

Fix the 504 Gateway Timeout Error in WordPress

The 504 Gateway Timeout Error can affect your website’s performance and user experience and even lead to a loss of potential visitors. However, the good news is that it’s not a permanent setback.

This error occurs when your server fails to receive a timely response from another server it is trying to communicate with.

This blog post guides you through a step-by-step process to fix the 504 Gateway Timeout Error in WordPress.

What Causes the 504 Gateway Timeout Error?

There are several reasons why your WordPress site might be experiencing the 504 Gateway Timeout error. Here are some common causes to consider:

  • Slow server response time—If your server takes too long to respond, you may receive a 504 error.
  • High website traffic – An influx of visitors can overwhelm your server’s resources, leading to a timeout error.
  • Plugin or theme conflicts – Certain plugins or themes may conflict with each other or with your server configuration, causing the error.
  • Server misconfiguration – Improper server settings or configuration can trigger the 504 error.
  • DNS issues – Problems with your DNS settings can prevent your server from connecting to the requested page.
  • Network congestion – Issues with network connectivity, either on your end or your hosting provider’s end, can lead to timeout errors.

Identifying the specific cause of the 504 Gateway Timeout error will help you apply the appropriate solutions to resolve it.

Top 5 Methods to Fix “504 Gateway Timeout Error “

  1. Reload the page
  2. Clear browser cache
  3. Enable debugging mode
  4. Disable plugins
  5. Increase PHP memory limit

Method 1: Reload the Page

One of the simplest and quickest solutions to try is to reload the page where the 504 Gateway Timeout error occurs. Sometimes, the error is temporary, and reloading the page can resolve it. Pressing the refresh button or using the keyboard shortcut (F5 or Command + R) can trigger a new request to the server and potentially eliminate the error.

🔥PLAY SAFE: GET STARTED WITH WP STAGING TO EFFICIENTLY MANAGE BACKUPS & CREATING STAGING ENVIRONMENTS.

Method 2: Clear Browser Cache

Clearing your browser cache is another effective method to fix the 504 Gateway Timeout error. Caches store temporary files; if they become corrupted or outdated, they can cause issues when loading web pages.

Follow these steps to clear your browser cache and potentially resolve the error:

  1. Launch your web browser and navigate to the settings menu.
  2. Go to the browsing history or privacy settings section.
Browsing history or privacy settings
  1. Find the clear browsing data option and choose it.
Cache-Clearing Option
  1. Choose the desired time range to clear the cache.
  2. Select the cache type you wish to clear, such as cookies or browsing history.
  3. Click the “Clear data” or “Clear cache” button to remove the selected data.
Clear browsing data

After clearing the cache, try reloading the webpage to see if the 504 Gateway Timeout error is resolved.

Method 3: Enable Debugging Mode

Enable debugging mode in WordPress to gather more detailed error information, which can help pinpoint the cause. To enable debugging mode in WordPress, follow these steps:

  1. Log in to your cPanel account provided by your hosting provider.
Cpanel Dashboard
  1. In the cPanel dashboard, locate the “File Manager” option and click on it.
Cpanel File Manager
  1. Navigate to the root directory of your WordPress installation (usually public_html or www).
Find public_html
  1. Find the wp-config.php file and right-click on it.
  2. Choose the “Edit” or “Code Edit” option from the context menu. If prompted, select “Edit” again.
Edit wp config File
  1. Look for the line in the wp-config.php file that says /* That's all, stop editing! Happy blogging. */.
  2. Just above that line, add the following code:
PHP
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
Add Debuging Code
  1. Save the changes to the wp-config.php file.
  2. Close the file manager and access your WordPress site.
Save WP Config File
  1. The debugging mode should now be enabled, and you can find the debug logs in the wp-content/debug.log file if any errors occur.
Find Debug log

Remember to disable debugging mode once you resolve the issue to avoid displaying sensitive information to visitors to your site.

Method 4: Disable Plugins

Deactivate plugins to identify if any are causing conflicts resulting in the 504 error.

To disable plugins in WordPress, follow these steps:

  1. Access your WordPress admin dashboard by logging in to your site.
Wordpress Dashboard
  1. Go to “Plugins” from the sidebar menu and click on it.
  2. You will see a list of installed plugins.
Plugin Tab
  1. Select the plugins you want to disable by clicking the checkboxes next to their names. You can choose multiple plugins at once.
Choose Multiple Plugins
  1. Once you have selected the plugins, look for the “Bulk Actions” dropdown menu at the top of the list and select “Deactivate.”
  2. Click the “Apply” button next to the dropdown menu.
Deactivate Plugins
  1. This step will deactivate the selected plugins and temporarily disable their functionalities.

Disabling plugins can help identify if they are causing conflicts or the 504 Gateway Timeout error. You can reactivate the plugins individually to determine which one might be causing the issue.

Method 5: Increase PHP memory limit

Increase the PHP memory limit in your server configuration or modify the wp-config.php file to allocate more resources to your site.

To increase the PHP memory limit in WordPress, you can follow these steps:

  1. Log in to your cPanel account provided by your hosting provider.
Cpanel Dashboard
  1. In the cPanel dashboard, locate the “File Manager” option and click on it.
Cpanel File Manager
  1. Navigate to the root directory of your WordPress installation (usually public_html or www).
Find public_html
  1. Find the wp-config.php file and right-click on it.
  2. Choose the “Edit” or “Code Edit” option from the context menu. If prompted, select “Edit” again.
Edit WP Config File
  1. Look for the line in the wp-config.php file that says /* That's all, stop editing! Happy blogging. */.
  2. Just above that line, add the following code:
PHP
define('WP_MEMORY_LIMIT', '256M');
Add PHP Increase Code

You can adjust the value’ 256M’ to the desired memory limit, such as ‘512M’ for 512 megabytes.

  1. Save the changes to the wp-config.php file.
  2. Close the file manager.
Save WP Config File
  1. Refresh your WordPress site and check if the PHP memory limit has been increased.

By increasing the PHP memory limit, you provide more memory resources for your WordPress site, which can help prevent memory-related issues and potentially resolve the 504 Gateway Timeout error.

Conclusion

The 504 Gateway Timeout error in WordPress can be resolved by clearing the browser cache, disabling plugins, and increasing the PHP memory limit. These steps can ensure a smoother browsing experience for your site visitors.