mirror of
https://github.com/dunglas/frankenphp.git
synced 2026-04-23 00:37:20 +08:00
2da08d635f
fixes https://github.com/php/frankenphp/issues/2274#issuecomment-4142767490 closes https://github.com/php/frankenphp/issues/1133 apache/nginx/caddy pass PHP_SELF as SCRIPT_NAME + PATH_INFO, but our PATH_INFO wasn't working because our matcher stripped the rest of the path. request url: localhost/index.php/en ``` # was non-worker: SCRIPT_NAME: /index.php PATH_INFO: PHP_SELF: /index.php REQUEST_URL: /en # was fastcgi: SCRIPT_NAME: /index.php PATH_INFO: /en PHP_SELF: /index.php/en REQUEST_URL: /en # was php_server worker SCRIPT_NAME: PATH_INFO: PHP_SELF: /en REQUEST_URL: /en # now is always: SCRIPT_NAME: /index.php PATH_INFO: /en PHP_SELF: /index.php/en REQUEST_URL: /en ``` --------- Signed-off-by: Marc <m@pyc.ac> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
29 lines
625 B
PHP
29 lines
625 B
PHP
<?php
|
|
|
|
ignore_user_abort(true);
|
|
|
|
$server_vars = [
|
|
'SCRIPT_NAME',
|
|
'SCRIPT_FILENAME',
|
|
'PHP_SELF',
|
|
'PATH_INFO',
|
|
'DOCUMENT_ROOT',
|
|
'DOCUMENT_URI',
|
|
'REQUEST_URI',
|
|
];
|
|
$handler = static function() use ($server_vars) {
|
|
foreach ($server_vars as $var) {
|
|
$value = $_SERVER[$var] ?? '(not set)';
|
|
echo $value !== '' ? "$var: $value\n" : "$var:\n";
|
|
}
|
|
};
|
|
|
|
if (isset($_SERVER['FRANKENPHP_WORKER'])) {
|
|
for ($nbRequests = 0, $running = true; $running; ++$nbRequests) {
|
|
$running = \frankenphp_handle_request($handler);
|
|
gc_collect_cycles();
|
|
}
|
|
} else {
|
|
$handler();
|
|
}
|