πŸ“„
Webhosting

Increasing PHP max_execution_time: how to fix timeouts

πŸ“… 17 October 2026 ✏️ 17 October 2026 ⏱ 5 min leestijd

Getting a ‘maximum execution time exceeded’ error message? Learn how to safely increase max_execution_time in Plesk, .htaccess, or php.ini.

Do you see the error message ‘Maximum execution time of X seconds exceeded’? Then a PHP script is taking longer than allowed and the server automatically stops the process. You can fix this by increasing the value of max_execution_time via Plesk, php.ini, or .htaccess. In this article you’ll learn how to do this safely, and when it’s better to look at the cause of the slow execution instead of just increasing the limit.

What is max_execution_time?

max_execution_time is a PHP setting that determines how many seconds a script is allowed to run before the server forcibly terminates it. This limit exists to prevent a stuck or inefficient script from endlessly holding onto server resources and thereby slowing down other websites on the same server.

You often run into this with:

  • Importing large data files (for example via WooCommerce CSV import)
  • Creating or restoring a backup of a large website
  • Heavy plugins or themes that perform a lot of calculations
  • Migrations where a lot of data is processed at once

Increasing max_execution_time in Plesk

With hosting using Plesk as a control panel, you can easily adjust this setting yourself, without having to edit server files.

1

Log in to Plesk

Go to your Plesk environment and log in with your account details.

2

Open your website

Click on ‘Websites & Domains’ in the menu and select the domain for which you want to adjust the setting.

3

Go to PHP settings

Click on ‘PHP Settings’ for the relevant domain.

4

Adjust max_execution_time

Find the max_execution_time option and increase the value, for example from 30 to 120 or 300 seconds.

5

Save and test again

Click ‘OK’ to apply the change and perform the action that initially got stuck again.

πŸ’‘ Tip: Don’t set the value unnecessarily high. A value like 120 or 300 seconds is usually more than enough for most heavy tasks. An extremely high limit can cause stuck scripts to keep holding onto resources for an unnecessarily long time.

Setting it via .htaccess or php.ini

If you don’t have Plesk access or you’re working in an environment without a control panel, you can also add the setting via code.

Via .htaccess (only works if the server allows it):

php_value max_execution_time 300

Via php.ini (if you have access to this file):

max_execution_time = 300

Via wp-config.php for WordPress, as a temporary solution for specific scripts:

set_time_limit(300);

Note: these code adjustments don’t always work, depending on how PHP is configured on the server (for example with PHP as FastCGI or the LiteSpeed module). In that case, it’s better to adjust the setting via the control panel, such as in Plesk.

When isn’t this the right solution?

Increasing the time limit solves the symptom, but not always the cause. First consider the following:

  • Is the script structurally slow? It may be poorly optimized or running too many processes at once. Look at the code or ask the developer for optimization.
  • Is it an import or export? Split large files into smaller parts, so each part can be processed within the normal time.
  • Does it happen during a backup? Check whether automatic backups run separately from manual actions, so you’re not dependent on a single timeout setting.
  • Does it happen more often on different sites? Then it could be due to server load rather than one specific script.

If you consistently run into slow database connections or stuck email functions, also take a look at your business email settings or the general server configuration within your web hosting package. When moving to another server, it’s sometimes necessary to check the PHP settings again; see switching to Tandata for more information.

Frequently asked questions

What is a normal value for max_execution_time?

For most websites, 30 to 60 seconds is sufficient. For heavy tasks such as imports or backups, 120 to 300 seconds is often enough.

Does increasing max_execution_time always work?

Not always. Some hosting configurations ignore changes made via .htaccess or wp-config.php. In that case, use the control panel, such as the PHP settings in Plesk.

Can too high a value cause problems?

Yes, an extremely high limit can cause stuck scripts to keep using server resources for a long time, which can slow down other processes.

Does this also fix a 504 Gateway Timeout?

Often yes, because a 504 error can sometimes occur when a script exceeds the allowed time. If the error persists, the cause may lie elsewhere in the server configuration.

Conclusion

You can usually fix a timeout message with PHP scripts by increasing max_execution_time via Plesk, .htaccess, or php.ini. Do this in moderation, and in case of recurring problems, investigate whether the real cause lies with the script, the import, or the server configuration rather than simply increasing the limit.

View web hosting β†’

Was dit artikel nuttig?