How to Increase PHP cURL Timeout in WooCommerce for the UK

17 August 2026

Learn how to increase PHP cURL timeout for WooCommerce to fix gateway errors, slow APIs, and import issues. UK-specific hosting tips included.

Why cURL Timeouts Happen in WooCommerce

WooCommerce relies on cURL to communicate with remote servers: payment gateways, shipping providers, licence checks, and third-party APIs. A cURL timeout occurs when the remote server doesn't respond within the default limit — usually 30 seconds. In the UK, slower international APIs, GDPR-compliant data processing, or even a misconfigured CDN like Cloudflare can push response times beyond that threshold. Symptoms include 'cURL error 28: Operation timed out', failed payment notifications, and stuck bulk imports. Understanding this is the first step to diagnosing whether you need to raise the timeout globally or just for specific WooCommerce requests, such as Sage Pay or Royal Mail shipping calculations.

Check Your Current Timeout Limit (UK Hosting Context)

Before making changes, confirm what your current cURL timeout is. Create a simple PHP file with `curl_getinfo($ch, CURLOPT_TIMEOUT)` or inspect your phpinfo() via a temporary admin script. UK hosts like Krystal or SiteGround often impose a 30-second max execution time, but cURL timeout can be separate. Also check whether your server uses PHP-FPM or Apache mod_php — the method to change limits differs. If you're on a managed WooCommerce host like WooCommerce UK or Pressable, you may not be able to modify php.ini directly, so you'll need a plugin or a snippet. Record the current value and test with your slowest endpoint, such as a US-based fulfilment API, to see if raising it actually resolves the issue.

Increase via wp-config.php for a Quick Global Fix

The most direct way to raise the cURL timeout in WooCommerce is to define a custom constant in your wp-config.php file. Add this line before the 'stop editing' comment: `define('WP_HTTP_BLOCK_EXTERNAL', false);` — not needed. Better, filter the timeout using `http_request_timeout` in your theme's functions.php, but if you want a bulk fix without coding, you can set `CURLOPT_TIMEOUT` globally by adding a custom PHP snippet to your active theme's functions.php or a must-use plugin. Unlike some global settings, this affects all cURL calls from WooCommerce, including cron jobs. For UK store owners who don't want to edit multiple files, a simple snippet is the quickest, reversible option. Always back up your wp-config.php and functions.php before editing.

Using .htaccess, php.ini, and UK-Specific Shared Hosts

If you're on shared hosting (common for UK startups), you may need to edit `.htaccess` to set `php_value max_execution_time 120` or use `php.ini` in the public_html folder with `max_execution_time = 120` and `max_input_time = 120`. However, these only affect execution time, not cURL's internal timeout. To change cURL timeout specifically, you must use PHP code. Some UK hosts, like 20i or Fasthosts, block .htaccess overrides; contact their support first. Alternatively, a plugin like 'WP Increase Max Upload Size' or 'CURL Timeout Fixer' can handle it via the dashboard — useful for non-developers. Remember that on UK servers with mod_security, long timeouts may be flagged; align with your host's acceptable use policy.

Testing and Avoiding Future Timeouts in WooCommerce

After increasing the timeout, test by running a WooCommerce action that previously failed — a manual payment gateway sync, a product CSV import, or a shipping rate request. Use browser dev tools to monitor the network response code and time. Also check your error logs (via cPanel or your UK host's log endpoint) for cURL error 28 or 7. If timeouts persist, the issue might be server DNS or a firewall, not cURL. For UK businesses, ensure you're not violating any GDPR data transfer rules by sending requests to slow international endpoints without a DPIA. Consider optimising your external calls: caching API responses, using UK-based endpoints, or upgrading to a host with better network routing, like a London data centre.

FAQ

By default, WordPress and WooCommerce set the HTTP request timeout to 5 seconds for remote requests, but cURL itself often inherits a 30-second default from server configuration. In practice, you may see timeouts as low as 5 seconds if your theme or plugin defines a custom value. Raising it to 30–60 seconds is recommended for UK stores using international payment gateways.

Latest guides