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.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF