diff options
Diffstat (limited to 'sapi/cli/php_cli_server.c')
-rw-r--r-- | sapi/cli/php_cli_server.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index ab2dc6c32b..365f352244 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -2069,7 +2069,15 @@ int do_cli_server(int argc, char **argv TSRMLS_DC) /* {{{ */ return 1; } } else { - document_root = "."; + char path[MAXPATHLEN]; + char *ret = NULL; + +#if HAVE_GETCWD + ret = VCWD_GETCWD(path, MAXPATHLEN); +#elif HAVE_GETWD + ret = VCWD_GETWD(path); +#endif + document_root = ret ? path : "."; } if (argc > php_optind) { |