I’m using php-fpm and have set a terminate_timeout=3 to stop any running scripts taking longer than 3 seconds, which works great.
However, occasionally, I will have a php script that NEEDS to run a bit longer, for instance, it’s accessing a 3rd party billing API that takes some time to return.
Is there any way that script can override the default timeout of php-fpm and ask for a little longer amount of time?
The options declared in
php-fpm.confare not reachable fromini_set()(along with the options defined for the fpm pool). However,create two pools with different options (note the two different ports)
(usually in
/etc/php5/fpm/pool.d/)You could also use the set_time_limit function (from the core, it doesn’t work in PHP safe-mode)
(I’m guessing (didn’t try) the php-fpm request_terminate_timeout option should probably be removed in this case if its value < set_time_limit)