Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions tests/test_5_fpm_handler.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php declare(strict_types=1);

header('X-Max-Execution-Time: ' . ini_get('max_execution_time'));

echo "Hello from Bref FPM!";

// Trigger a warning to test that it is not sent to stdout
Expand Down
6 changes: 6 additions & 0 deletions tests/test_5_fpm_invocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,10 @@ function post(string $url, string $body)
error('Unexpected response: ' . json_encode($response));
}

// PHP-FPM has no CPU time limit: Bref stops requests before the Lambda timeout
$maxExecutionTime = array_change_key_case($response['headers'])['x-max-execution-time'] ?? null;
if ($maxExecutionTime !== '0') {
error('Unexpected max_execution_time: ' . json_encode($response));
}

success('[Invoke] FPM');