Skip to content

Commit e1b87cc

Browse files
author
Jérôme Loyet
committed
- Fixed #52045 (FPM tries to open php.ini from the current dir)
- Add php_ini_ignore_cwd to _sapi_module_struct
1 parent b896c87 commit e1b87cc

File tree

4 files changed

+4
-1
lines changed

4 files changed

+4
-1
lines changed

main/SAPI.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ struct _sapi_module_struct {
251251
char *executable_location;
252252

253253
int php_ini_ignore;
254+
int php_ini_ignore_cwd; /* don't look for php.ini in the current directory */
254255

255256
int (*get_fd)(int *fd TSRMLS_DC);
256257

main/php_ini.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ int php_init_config(TSRMLS_D)
461461
#endif
462462

463463
/* Add cwd (not with CLI) */
464-
if (strcmp(sapi_module.name, "cli") != 0) {
464+
if (!sapi_module.php_ini_ignore_cwd) {
465465
if (*php_ini_search_path) {
466466
strlcat(php_ini_search_path, paths_separator, search_path_size);
467467
}

sapi/cli/php_cli.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,7 @@ int main(int argc, char *argv[])
734734
cli_sapi_module.ini_defaults = sapi_cli_ini_defaults;
735735
cli_sapi_module.php_ini_path_override = NULL;
736736
cli_sapi_module.phpinfo_as_text = 1;
737+
cli_sapi_module.php_ini_ignore_cwd = 1;
737738
sapi_startup(&cli_sapi_module);
738739

739740
#ifdef PHP_WIN32

sapi/fpm/fpm/fpm_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,6 +1566,7 @@ int main(int argc, char *argv[])
15661566

15671567
sapi_startup(&cgi_sapi_module);
15681568
cgi_sapi_module.php_ini_path_override = NULL;
1569+
cgi_sapi_module.php_ini_ignore_cwd = 1;
15691570

15701571
#ifdef PHP_WIN32
15711572
_fmode = _O_BINARY; /* sets default for file streams to binary */

0 commit comments

Comments
 (0)