Skip to content

Instantly share code, notes, and snippets.

@ryangreenberg
Created November 7, 2019 16:47
Show Gist options
  • Save ryangreenberg/6c2b36d9e7c9833eb2581d1ff76d775e to your computer and use it in GitHub Desktop.
Save ryangreenberg/6c2b36d9e7c9833eb2581d1ff76d775e to your computer and use it in GitHub Desktop.
Simple HHVM server
function main(): noreturn {
$rsp = dict[
'$_SERVER' => $_SERVER,
'$_GET' => $_GET,
'$_POST' => $_POST,
'$_REQUEST' => $_REQUEST,
'getallheaders' => getallheaders(),
'body' => file_get_contents('php://input'),
];
echo json_encode($rsp, JSON_PRETTY_PRINT);
exit(0);
}
main();
#!/bin/bash
# See https://stackoverflow.com/questions/59895
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$dir"
hhvm --no-config --mode server --port 8888 -d hhvm.server.default_document=index.hack -d hhvm.server.error_document404=index.hack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment