Bobcares

Top 3 ways to increase max_execution_time in WordPress

by | Feb 18, 2020

A common fix for website timeout errors is to increase max_execution_time in WordPress.

Usually, WordPress users see the message ‘Fatal error: Maximum execution time of xx seconds exceeded…‘ due to server-side limitations.

At Bobcares, we often get requests from our customers to fix WordPress errors as part of our Server Management Services.

Today, let’s get into the details on how our Support Engineers increase max_execution_time in WordPress.

 

What leads to max_execution_time related WordPress errors?

Let’s now see more details on what causes the maximum execution time errors.

Every server sets a limit on the maximum time a script can run on the server. When any script exceeds this time limit, the server automatically terminates it. This comes as a default security standard on servers.

In a similar way, WordPress scripts are written in PHP also depends on the server PHP configuration limits. The max_execution_time in PHP is the amount of time that your WordPress site will spend on a single operation before timing out.

The error is the security precaution taken by WordPress. By default, the maximum execution time for PHP is set as 30 seconds. When a script reaches the maximum execution time limit of 30 sec, then it results in maximum execution time exceeded error.

Increase max_execution_time in WordPress

 

How to Increase max_execution_time in WordPress?

At Bobcares, where we have more than a decade of expertise in managing servers, we often see similar WordPress errors.

Now, let’s see how our Support Engineers increase max_execution_time in WordPress by different methods.

  • altering directive in PHP.ini file
  • Editing WordPress configuration file wp-config.php
  • using .htaccess file

Altering the PHP settings of a domain counts on the mode in which PHP runs on the server. Therefore, when the customer reports the error, the primary check involves checking the server PHP mode.

 

1. Altering PHP.ini file

We can edit the websites php.ini file to increase the Maximum Execution Time. Or, if the website uses the server’s main PHP config file, we make changes at /etc/php.ini. This file is the default PHP configuration file.

However, in case of servers running PHP as suPHP or FastCGI, websites will have custom php.ini. You’ll most likely find it in the website root folder. Moreover, the location of the file will vary by host.

As the primary step, we make sure to back up a copy of this file before attempting to edit it.

We then edit the php.ini file and add the following directives to the following values to avoid further PHP errors to the website.

memory_limit = 256M
upload_max_size = 64M
post_max_size = 64M
upload_max_filesize = 64M
max_execution_time = 300
max_input_time = 1000

Further, it also requires editing the timeout values in the web server configuration too. WordPress often show it as a warning message for using too low values.

increase_wordpress_max_execution_time

Modifying the server values resolves the problem.

 

2. Editing wp-config.php

The wp-config.php file is the default configuration file of the WordPress website.

It’s another alternative to the PHP.ini method. Usually, this method is used in the shared hosting companies. Here, according to the need of customers requirement, we increase individually.

We can add/edit the following line in the wp-config.php of your WordPress

set_time_limit(300);

3. Editing .htaccess file

Similarly, max_execution_time can be set in the .htaccess file in the WordPress site’s back end.

WordPress uses this file to manipulate how Apache (server) serves files from its root directory and subdirectories. The file is vital and often bad edits break the website.

We add some directives at the end of the file to increase the PHP maximum execution time.

For this, we access the website’s root directory, which contains the wp-config.php file. In cPanel servers, it will be public_html. We then find the .htaccess file.

Thereafter we open it and add the following at the end of the file.

php_value memory_limit 256M
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 1000

Finally, we save the changes made.

Then restart the Apache service.

service apache2 restart

That solves the error with maximum execution time.

[Stuck with WordPress timeout errors? – Our Experts are available 24/7.]

 

Conclusion

In short, the methods to increase max_execution_time in WordPress involves altering PHP.ini file, editing wp-config.php, editing .htaccess, etc. Today, we saw how our Support Engineers help our customers fix this problem.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

2 Comments

  1. sana makhloufi

    unfortunately I tested the 3 ways, and I have the same error

    Reply
    • Hiba Razak

      Hi Sana,

      Our Experts can help you with the issue, we’ll be happy to talk to you on chat (click on the icon at right-bottom).

      Reply

Submit a Comment

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

Never again lose customers to poor
server speed! Let us help you.