Working setup, assume a request to http://127.0.0.1:8080/path/to/resource
:
- nginx/apache receives the request and passes it to index.php behind the scenes to hhvm vi FastCGI.
- After the the handoff via FastCGI, the
$_SERVER['SCRIPT_NAME']
is alwaysindex.php
and the$_SERVER['REQUEST_URI']
is from the url/path/to/resource
(notice, noindex.php
anywhere in it) - I've got a framework with an
index.php
file in /some/path/public/index.php - All requests go to
index.php
and have their URI's (in this case `/path/to/resource) parsed by a routing system. - The actual code handling the request have no structural relation in form to the URI (i.e. there's no /path/to/resource/index.php)
In order to take nginx or apache out of the picture when running hhvm for dev purposes or just fun, I run hhvm in server mode (NOT FastCGI mode!!!):
cd /some/path/public/
hhvm -m server -p 8080
However, the framework doesn't handle the index.php
in the path gracefully. When served by hhvm running in server mode the only urls that work are:
http://127.0.0.1:8080/index.php
...or...
http://127.0.0.1:8080
Anything more complex fails like:
http://127.0.0.1:8080/path/to/resource (HHVM fails, file not found)
Also, sticking in an explicit index.php fails as the framework doesn't handle the index.php
in the REQUEST_URI
gracefully.
http://127.0.0.1:8080/index.php/path/to/resource (HHVM works, but framework fails, `index.php` in uri confuses it)
Does anyone know a way to get this to work where ALL request are sent to the root /some/path/public/index.php? Is there an option to set the SCRIPT_NAME explicitly via a option flag/setting?
Ideally the request http://127.0.0.1:8080/path/to/resource
would have:
- SCRIPT_NAME =
index.php
- REQUEST_URI =
/path/to/resource