forked from ircmaxell/php-compiler
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.php
More file actions
30 lines (27 loc) · 925 Bytes
/
Copy pathexample.php
File metadata and controls
30 lines (27 loc) · 925 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
/**
* Minimal FastCGI / deploy presenter (issue #2331).
*
* Routes (PATH_INFO after front controller):
* empty PATH_INFO → health plain-text "ok"
* any other path → echo REQUEST_URI and SCRIPT_NAME (CGI diagnostics)
*
* VM:
* ./phpc run examples/009-FastCGIWeb/example.php
*
* Serve (loopback harness until FastCGI adapter #173):
* ./phpc serve 127.0.0.1:8080 examples/009-FastCGIWeb
* curl -s http://127.0.0.1:8080/example.php
* curl -s http://127.0.0.1:8080/example.php/ping
*
* Deploy + nginx/FastCGI: docs/deploy-web-aot.md (#445); integration target #173.
*/
$pathInfo = $_SERVER['PATH_INFO'] ?? '';
header('Content-Type: text/plain; charset=UTF-8');
if ($pathInfo !== '') {
echo 'REQUEST_URI='.($_SERVER['REQUEST_URI'] ?? '/')."\n"
.'SCRIPT_NAME='.($_SERVER['SCRIPT_NAME'] ?? '/example.php')."\n"
.'PATH_INFO='.$pathInfo."\n";
} else {
echo "ok\n";
}