You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix value of PHP_SELF when router script is in a subdirectory
PHP's built-in web server sets the value of `$_SERVER['PHP_SELF']` differently
when the router script is in working directory versus a subdirectory of the
working directory. This breaks routing functionality in routing libraries such
as [Slim](https://www.slimframework.com).
When the script is in the working directory, the value of `PHP_SELF` is the
filename of the script, but when run from a parent directory of the script it
changes to being the path requested of the web server.
This commit changes `bootstrap` behaviour when referring to the Lambda handler.
If it refers to a script in a subdirectory of the task root, it changes the
`chdir` call to enter that directory before running the PHP internal web-server,
so that it can refer to the script filename as being in the working directory.
This poses no change to how the layer is configured or run, but `PHP_SELF` now
correctly refers to the filename and this solves the issue with Slim.
Resolves: stackery#11
0 commit comments