How to raise maximum execution time in WordPress?

One of the server security is setting a time limit for PHP processes so-called Maximum Execution Time. This limit allows canceling the PHP process after reaching the assumed time by the process. Unfortunately, in the case of complicated processes triggered by some WordPress plugins or even software updates, it turns out that the limits are set too low and the processes are not finished.

If in dashboard or debug.log file you will see the message, after launching an update or other processes, like this one:

Fatal error: Maximum execution time of 5 seconds exceeded in

Don't panic :) The problem can be frustrating, especially for less experienced WordPress users - but it is very easy to repair. Below is a way to deal with it.

.htaccess changing

  1. Connect to your FTP server using FileZilla, Total Commander, or another FTP client.
    You can find the .htaccess file in the root directory of your site. This is the same directory where wp-content and wp-admin folders are located.

  2. After opening the file, add the following line to it:
    php_value max_execution_time 300

  3. Save the file and make sure that the change has been made.

The code above sets the value of the maximum execution time of the PHP process for 300 seconds. If the error still appears, try to simply increase the value, e.g. up to 600.

There is no .htaccess in any directory

If you have not found the .htaccess file, it may not have been generated by your website yet.
To create a file and the change described above, go to your Settings > Permalinks in your WordPress, then click Save Changes

how to change max execution time in wordpress

After saving the settings WordPress will create a .htaccess, which you can modify according to the above instructions.

Still need help? Contact Us Contact Us