From b0c4e5ac33e8168239fb7f076d63676f1ef51175 Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Tue, 24 Nov 2026 14:39:29 +0100 Subject: [PATCH 1/2] Remove PHP-FPM's 30 second CPU time limit PHP-FPM defaulted to max_execution_time=30 (CPU time), whatever the Lambda function's timeout: a CPU-heavy request in a function with a longer timeout failed after 30 seconds of CPU. Bref already stops requests before the Lambda timeout. --- src/php.ini | 5 +++++ tests/test_5_fpm_handler.php | 2 ++ tests/test_5_fpm_invocation.php | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/src/php.ini b/src/php.ini index bdda2227..5c75488e 100644 --- a/src/php.ini +++ b/src/php.ini @@ -9,6 +9,11 @@ error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT memory_limit=10240M +; PHP-FPM defaults to 30 seconds of CPU time, whatever the timeout of the Lambda function. +; Bref stops PHP-FPM requests before the Lambda timeout instead (that limit counts the time spent waiting). +; The CLI already has no limit. +max_execution_time=0 + opcache.enable=1 opcache.enable_cli=1 diff --git a/tests/test_5_fpm_handler.php b/tests/test_5_fpm_handler.php index 5af8df72..7da7d762 100644 --- a/tests/test_5_fpm_handler.php +++ b/tests/test_5_fpm_handler.php @@ -1,5 +1,7 @@ Date: Tue, 24 Nov 2026 14:44:39 +0100 Subject: [PATCH 2/2] Fix the header name in the test --- tests/test_5_fpm_invocation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_5_fpm_invocation.php b/tests/test_5_fpm_invocation.php index 84e0936f..83e59396 100644 --- a/tests/test_5_fpm_invocation.php +++ b/tests/test_5_fpm_invocation.php @@ -39,7 +39,7 @@ function post(string $url, string $body) } // PHP-FPM has no CPU time limit: Bref stops requests before the Lambda timeout -$maxExecutionTime = $response['headers']['x-max-execution-time'] ?? $response['multiValueHeaders']['x-max-execution-time'][0] ?? null; +$maxExecutionTime = array_change_key_case($response['headers'])['x-max-execution-time'] ?? null; if ($maxExecutionTime !== '0') { error('Unexpected max_execution_time: ' . json_encode($response)); }