PHP Maximum execution time exceeded

Started by ThomasE, April 10, 2025, 08:45:09 AM

Previous topic - Next topic
Hi,

I'm currently getting the following error message whenever a hit "Apply Changes" in interface configuration:

PHP Fatal error:  Maximum execution time of 300 seconds exceeded in /usr/local/etc/inc/plugins.inc.d/ipsec.inc on line 144
Occasionally it's in a different file, but I don't think that matters. After some examination I have a good idea of what's happening and I know what I've done, so I'm aware what's caused it. If I'm not totally wrong, I know a way that should fix this once and for good - I just don't know how to do it.

I was tasked with reconfiguring some 80 interfaces - a rather simple change of the respective interface IPs. Applying changes after one interface takes between 30 and 60 seconds. Don't know why it takes so long, but it doesn't really matter. We have a rather big setup which is working just fine, so this is not a problem as that kind of change is not something that we do frequently. Rather than doing something every single minute or so I figured it might be a good idea to do a bulk change meaning I reconfigure a greater number of interfaces, then hit "Apply changes" and have much longer time that I can use to do something else. This was a bad idea, because after some time I get the error message mentioned above. About 20 interfaces have been reconfigured as expected - the other ones haven't. Hitting "Apply changes" will start the whole process from the very beginning, which I suppose is "by design".

I can think of three different approaches to this problem - in order of preference:

  • Applying changes to each interface individually on CLI.
  • Temporarily increasing PHP max_exection_time.
  • Rebooting the system.

So far I haven't found a way to do (1) and I'm open for suggestions. As for (2), I have tried modifying max_exection_time in /usr/local/etc/php.ini as well as in /usr/local/lib/php.ini, which are the only places where max_execution_time=300 is being set. (I changed the value to 3000 as this is only meant to be a temporary fix.) However, that doesn't seem to change anything. Rebooting the system (3) would cause a downtime that I'd like to avoid. This will be my last option if everything else fails.

Thanks
Thomas

I'd say the proper place is /usr/local/opnsense/service/templates/OPNsense/WebGui/php.ini - followed by

configctl webgui restart

for changes to have effect.

Quote from: doktornotor on April 10, 2025, 09:31:01 AMI'd say the proper place is /usr/local/opnsense/service/templates/OPNsense/WebGui/php.ini - followed by

configctl webgui restart

for changes to have effect.

Thanks! That was it! I already identified that file and modified it, but I did a
service configd restart

as suggested by - among others - ChatGPT rather than a

configctl webgui restart

That did it. :)

Thanks.

Uh, so

> PHP Fatal error:  Maximum execution time of 300 seconds exceeded in /usr/local/etc/inc/plugins.inc.d/ipsec.inc on line 144

is

(new \OPNsense\IPsec\Swanctl())->isEnabled()

And it requires configd to operate... was it stopped? Check dmesg for OOM kills.



Cheers,
Franco