• Resolved jodamo5

    (@jodamo5)


    In Query Monitor on the Overview tab I get a warning, “No execution time limit. The max_execution_time PHP configuration directive is set to 0.”

    On the Environment tab it says:

    max_execution_time 0
    Overridden at runtime from 150

    My host has checked the settings and in everywhere we can it find is set to 150.

    When we run ini_get("max_execution_time"); it returns 150.

    I realise that PHP doesn’t expose necessarily what is overriding the value for Query Monitor to tell us, but can you please explain how Query Monitor is determining that the max_execution_time is being overridden to 0? That might help us determine what is going on.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    This means that a plugin or theme on your site is overriding the value during the page generation. As you point out, it is unfortunately impossible for QM to know when or where it changed.

    Your best bet it to grep your plugin and theme files for ini_set or max_execution_time and see what shows up.

    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    For a bit more information, QM collects the “before” value as early as possible, which is inside wp-content/db.php if it’s present, and it collects the “after” value during its processing which happens on the shutdown hook which is itself run by WordPress core during a PHP shutdown handler. It uses ini_set both times.

    That means QM should detect a change to this value at any point during the page load.

    Thread Starter jodamo5

    (@jodamo5)

    Thanks for the answers John. I searched all code on the site and found that WP All Export plugin had a max_execution_time override in the code that pulled in a settings field value. However, the settings field was set to 120. I decided to test it anyway by deactivating the plugin and Query Monitor now says that the max_execution_time is 150 (which is the value set in php.ini).

    So it would seem to be fixed, however it seems very strange to me! For two reasons:
    Firstly because WP All Export is a very robust and well-known plugin. And secondly, we use that plugin on a number of other sites, and Query Monitor doesn’t give that error on any of the other sites. All the other sites get the php.ini value for max_execution_time when WP All Export is activated. I’ve checked, and the version of the plugin is the same on both sites, and the settings are the same. So I’m at a loss as to how to explain Query Monitor reporting a problem on one of the sites when WP All Export is activated, and not on another site with the same settings in place.

    If you have any further guidance, that would be great. Otherwise, we can just close the ticket. Thanks for your help.

    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    If you change that setting to another value, eg. 200, does it get reflected correctly in QM? And does that happen on your other sites?

    Thread Starter jodamo5

    (@jodamo5)

    Hi John. On further investigation I was slightly wrong. It wasn’t pulling the max_execution_timefrom a editable field, but it was pulling it from the database.

    WP All Export plugin has default values built into the plugin that get inserted into the options table under this entry: PMXE_Plugin_Options

    The problematic code was in this plugin file: \wp-all-export\actions\wp_loaded.php

    
    $maxExecutionTime  = PMXE_Plugin::getInstance()->getOption('max_execution_time');
    	if($maxExecutionTime == -1) {
    		$maxExecutionTime = 0;
    	}
    
    	@ini_set("max_execution_time", $maxExecutionTime);
    

    The default value for max_execution_time in the plugin is 0. And there is no way to edit that value in the free version of the plugin. (As a test I changed the value in the database and the new value did pull through).

    Also is was strange to see that the max_execution_time was getting overridden on every page load and not just when WP All Export was actually running an export!

    This is only happening in the free version of their plugin. When I checked the other sites we have where the issue isn’t occurring I realised that we were running WP All Import Pro. So that problem is not in the Pro version, only the free version.

    I have raised this with the developers and removed the plugin from my site.

    Thanks for your help and excellent support!

    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Thanks for the update! It’s unfortunate that this isn’t easier to debug, but at least being aware of the change in values during runtime helps you get started.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How does Query Monitor determine max_execution_time is Overridden at runtime’ is closed to new replies.