@@ -56,7 +56,7 @@ class Tester
56
56
/**
57
57
* @var array
58
58
*/
59
- static private array $ filesToClean = ['.user.ini ' ];
59
+ static private array $ filesToClean = ['.user.ini ' , ' php.ini ' ];
60
60
61
61
/**
62
62
* @var bool
@@ -496,12 +496,12 @@ class Tester
496
496
/**
497
497
* Start PHP-FPM master process
498
498
*
499
- * @param array $extraArgs Command extra arguments.
500
- * @param bool $forceStderr Whether to output to stderr so error log is used.
501
- * @param bool $daemonize Whether to start FPM daemonized
502
- * @param array $extensions List of extension to add if shared build used.
503
- * @param array $iniEntries List of ini entries to use.
504
- * @param array|null $envVars List of env variable to execute FPM with or null to use the current ones.
499
+ * @param array $extraArgs Command extra arguments.
500
+ * @param bool $forceStderr Whether to output to stderr so error log is used.
501
+ * @param bool $daemonize Whether to start FPM daemonized
502
+ * @param array $extensions List of extension to add if shared build used.
503
+ * @param array|string $iniEntries List of ini entries or content of php.ini to use.
504
+ * @param array|null $envVars List of env variable to execute FPM with or null to use the current ones.
505
505
*
506
506
* @return bool
507
507
* @throws \Exception
@@ -511,7 +511,7 @@ class Tester
511
511
bool $ forceStderr = true ,
512
512
bool $ daemonize = false ,
513
513
array $ extensions = [],
514
- array $ iniEntries = [],
514
+ array | string $ iniEntries = [],
515
515
?array $ envVars = null ,
516
516
) {
517
517
$ configFile = $ this ->createConfig ();
@@ -536,8 +536,15 @@ class Tester
536
536
}
537
537
}
538
538
539
- foreach ($ iniEntries as $ iniEntryName => $ iniEntryValue ) {
540
- $ cmd [] = '-d ' . $ iniEntryName . '= ' . $ iniEntryValue ;
539
+ if (is_string ($ iniEntries )) {
540
+ $ iniFile = __DIR__ . '/php.ini ' ;
541
+ $ this ->trace ('Writing php.ini file ' , $ iniEntries , isFile: true );
542
+ file_put_contents ($ iniFile , $ iniEntries );
543
+ $ cmd [] = '-c ' . $ iniFile ;
544
+ } else {
545
+ foreach ($ iniEntries as $ iniEntryName => $ iniEntryValue ) {
546
+ $ cmd [] = '-d ' . $ iniEntryName . '= ' . $ iniEntryValue ;
547
+ }
541
548
}
542
549
543
550
if ($ envVars ['TEST_FPM_RUN_AS_ROOT ' ] ?? getenv ('TEST_FPM_RUN_AS_ROOT ' )) {
0 commit comments