How to Increase PHP Time Limit for a WordPress Site?

how to increase PHP time limit in WordPress

Are you looking to increase PHP Time Limit in WordPress?

During WordPress-ing, you may encounter ‘Maximum execution time of 30 seconds exceeded’ or ‘Maximum execution time of 60 seconds exceeded’.

It means that the task executed is taking more time than the PHP has assigned.

In this short tutorial article, I will show you how you can increase the PHP Time Limit.

What is PHP Time Limit?

As WordPress built on PHP, there is a lot of PHP execution going on in the background. To keep everything in order, WordPress developers add the PHP Time Limit.

PHP Time Limit caps the time that could be spent on one task to execute. If that script or code does not load under that time, the PHP will show the time out.

If the operation is critical to load the page, it will return the fatal error showing that the PHP has run out of the time.

You can quickly increase that time. However, the PHP operation should not take more than 3-4 seconds.

Must Read: How to Disable PHP Execution in WordPress Directories?

Increase PHP Time Limit by using wp-config.php

You have to edit the wp-config.php file from the WordPress core folder.

Go to your cPanel and open the File Manager. In the root folder, you will find the wp-config.php.

Edit the file and add the following line of code into it.


Hit the save button to save changes. Come back to your site to check if it is still showing the error.

Increase PHP Time Limit using .htaccess

If you do not want to make changes in the config.php file, you can increase the PHP time limit with the .htaccess file.

You can edit the .htaccess file from the WordPress dashboard or backend file manager.

Whichever way you choose, you have to paste the following code into the .htaccess file.

max_execution 300

Save the changes, and check if the error is gone. Most of the time, this will solve the error of the time limit.

Must Read: Best PHP Editors and PHP IDE for the Development

PHP maximum execution time limit in php.ini

Making edits in the php.ini file affects all the php scripts of the system. For content management systems like WordPress, Magento and Drupal, it is the best solution as you don’t have to make changes in each folder.

Open php.ini file using your favorite text editor.

$ sudo vi /etc/php/7.2/apache2/php.ini

Look for max_execution_time directive.

; Maximum execution time of each script, in seconds
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 30

Set the value for max_execution_time in seconds.

max_execution_time = 300

Restart your web server.

$ sudo systemctl restart apache2

Contact the Host

Sometimes, the hosting provider does not let the users increase the PHP time limit.

If you cannot do it by editing the .htaccess file or wp-config.php file, you should contact your host. 

Just connect with your hosting company. A quality hosting provider will do it gladly.

Wrap Up

Getting error due to the low PHP time limit could be irritating. 

In this quick post, I mentioned the easiest methods to increase the WordPress site’s PHP time limit.

I hope it helps you, and if there are any questions and doubts, please leave them in the comment box.

Latest WordPress Tips, Guides, & News

Stay updated with new stuff in the WP ecosystem including exclusive deals, how-to articles, new plugins, and more. 100% WordPress Goodness, a promise!

2 thoughts on “How to Increase PHP Time Limit for a WordPress Site?”

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top

We can help you. Right now.

Fast growing merchants depend ServerGuy for high-performance hosting. Experience counts. Let's get started.

Talk to a sales representative

USA / Worldwide




Core Web Vitals Book COver

Is your website ready for Core Web Vitals?

Take this FREE book with you and optimize your store for speed.

Learn all about new Google new ranking factors and get that top ranking.