The error "Fatal error: Maximum execution time of 30 seconds exceeded" often appears when you upload a theme, import data or run a long task in WordPress. It is frustrating, but the fix is simple.
Key takeaways
- PHP stops scripts that run longer than max_execution_time.
- Raise the value in php.ini (or .htaccess or your hosting panel).
- Restart the web server after changing php.ini.
- Avoid 0 (unlimited) on live sites. Use a value like 300.
The cause: PHP execution time limit
PHP gives each script a default time allowance, often 30 seconds. If a task, such as uploading a large theme file or importing demo content, runs longer than that, the server stops it and shows a fatal error.
The solution: raise the limit in php.ini
Edit php.ini and increase max_execution_time:
max_execution_time = 300
A value of 0 means unlimited. It works, but it is risky on a live site because runaway scripts can hang the server, so prefer a number such as 300 (5 minutes).
Other places to set it
- .htaccess (Apache with mod_php): php_value max_execution_time 300
- wp-config.php: add set_time_limit(300); near the top.
- Hosting control panel: many hosts have a PHP settings page.
Works for any PHP application
The same fix applies to any script that reports a maximum execution time error, including custom PHP apps, Joomla and Drupal.
- Find the php.ini file, often in the root directory or /etc/.
- Search for max_execution_time.
- Set it to a higher number such as 300.
- Restart Apache or Nginx (or PHP-FPM) so the change takes effect.
Still stuck? Our WordPress and web development team can help.
Frequently asked questions
Is it safe to set max_execution_time to 0?
It removes the limit, which can let faulty scripts run forever. On live sites use a high but finite value.
Why do I still see the error after changing php.ini?
The web server or PHP-FPM needs a restart, or your host overrides the setting. Check your hosting control panel.



