Fixing "Maximum execution time exceeded" in WordPress
In short
Maximum execution time exceeded means PHP aborted a script, often the default 30 seconds, typically during imports, migrations, or large backups; raising max_execution_time in php.ini, .htaccess, or .user.ini fixes legitimate long-running tasks. If a normal page request times out, though, the limit is not the real problem – a runaway database query, a hanging plugin, or an infinite loop is, and a higher value only delays the next crash.
An import runs, an update drags on, a backup is working – and suddenly: “Fatal error: Maximum execution time of 30 seconds exceeded.” PHP aborts a script that runs longer than allowed. For legitimate, longer-running tasks you raise the limit; sometimes, though, the long run is the real symptom.
Check the Current Value
You’ll find max_execution_time under Tools → Site Health → Info → Server (entry “PHP time limit”). The default is often 30 seconds. For imports, migrations or large backups, that’s quickly too little.
Raising the Execution Time
Pick a value in seconds, copy the matching snippet:
PHP Limits Generator
Set a PHP limit
Pick a limit, copy the right file. Everything runs in your browser.
Your input never leaves the browser. Snippets are generated locally via JavaScript.
Also available as a standalone page with all guides: PHP limits generator.
A quick word:
php.ini– if you control the server..htaccess– Apache with mod_php only. On PHP-FPM/FastCGI → use.user.ini..user.ini– for PHP-FPM/FastCGI/CGI.
Note: WordPress has no constant of its own for
max_execution_timeinwp-config.php. In your own code you can useset_time_limit( 300 );at runtime – but that’s an exception for specific spots, not a permanent fix.
With web servers like Nginx, a gateway timeout (FastCGI) can also apply, set independently of PHP. If the error persists despite a higher PHP value, that’s usually the reason – and only the host can help.
When a Higher Value Isn’t the Fix
If a perfectly normal page request aborts after 30 seconds, the time limit isn’t the problem – a runaway query or a hanging plugin is. A higher limit then only extends the wait until it breaks again. Typical culprits are a plugin that queries external servers on every request and waits for a response, an unfavourable database query over a huge table, or an infinite loop in custom code. In those cases, hunting the cause via WP_DEBUG_LOG and deactivating plugins step by step is worth more than any bigger value.
Execution Time and Memory Are Linked
Timeouts often occur together with memory problems: an import that runs too long frequently hits the memory limit too. If you raise the execution time, it’s worth checking the memory at the same time → increase the WordPress memory limit. A broader overview of other errors is in the overview of WordPress errors.
If it aborts despite a higher limit, or you want the real cause narrowed down: drop us a line – we’ll find out what’s taking so long. Recurring timeouts are often a sign of a neglected setup – as part of our WordPress maintenance we keep performance and updates under continuous watch.
Frequently Asked Questions
What does 'Maximum execution time exceeded' mean?
PHP limits how long a single script may run – often 30 seconds by default. If a process exceeds this time, PHP aborts it with the message Maximum execution time exceeded. This typically happens during imports, migrations, large backups or heavy plugin operations that take longer than the set limit allows.
How do I increase the maximum execution time in WordPress?
Via one of the server configuration files: php.ini if you control the server, .htaccess on Apache with mod_php, or .user.ini on PHP-FPM and FastCGI. There you set max_execution_time to a higher value in seconds. WordPress offers no constant of its own for it in wp-config.php. For specific spots in your own code, set_time_limit works too, but only as an exception, not a permanent fix.
Where do I set max_execution_time?
The right place depends on your server setup: php.ini for full server access, .htaccess only on Apache with mod_php, .user.ini on PHP-FPM, FastCGI or CGI. You can see the current value in the WordPress backend under Tools, Site Health, Info, Server. The generator on this page produces the matching snippet for each file.
When doesn't a higher time limit help?
When a perfectly normal page request aborts after 30 seconds. Then the time limit isn't the problem but a runaway database query, a hanging plugin or an infinite loop. A higher limit then only extends the wait until the next abort. In that case, hunting the cause via WP_DEBUG_LOG and deactivating plugins step by step is worth more than any bigger value.
Related Services
Founder & Full-Stack Developer
20+ years of web development experience. Specialised in Laravel, WordPress and custom software for mid-sized businesses.