Skip to content
Snippets Groups Projects

Issue #3275324: If the PHP binary is not in the PHP interpreter's PATH, Composer invocations fail

Merged Issue #3275324: If the PHP binary is not in the PHP interpreter's PATH, Composer invocations fail
Merged Adam G-H requested to merge issue/automatic_updates-3275324:3275324-if-the-php into 8.x-2.x
1 file
+ 6
2
Compare changes
  • Side-by-side
  • Inline
@@ -74,8 +74,12 @@ final class ProcessFactory implements ProcessFactoryInterface {
@@ -74,8 +74,12 @@ final class ProcessFactory implements ProcessFactoryInterface {
if ($this->isComposerCommand($command)) {
if ($this->isComposerCommand($command)) {
$env['COMPOSER_HOME'] = $this->getComposerHomePath();
$env['COMPOSER_HOME'] = $this->getComposerHomePath();
}
}
// Ensure that the directory with PHP's binaries is in the PATH.
// Ensure that the directory containing the PHP interpreter is in the PATH.
$env['PATH'] = $this->getEnv('PATH') . ':' . PHP_BINDIR;
// If the server is running the command-line interface, the directory of
 
// PHP_BINARY is more likely to be accurate; otherwise, the compile-time
 
// PHP_BINDIR is the better candidate.
 
$php_dir = PHP_SAPI === 'cli' ? dirname(PHP_BINARY) : PHP_BINDIR;
 
$env['PATH'] = $this->getEnv('PATH') . ':' . $php_dir;
return $process->setEnv($env);
return $process->setEnv($env);
}
}
Loading