Loading package_manager/src/ProcessFactory.php +20 −2 Original line number Diff line number Diff line Loading @@ -74,11 +74,29 @@ final class ProcessFactory implements ProcessFactoryInterface { if ($this->isComposerCommand($command)) { $env['COMPOSER_HOME'] = $this->getComposerHomePath(); } // Ensure that the running PHP binary is in the PATH. $env['PATH'] = $this->getEnv('PATH') . ':' . dirname(PHP_BINARY); // Ensure that the PHP interpreter is in the PATH. $env['PATH'] = $this->getEnv('PATH') . ':' . static::getPhpDirectory(); return $process->setEnv($env); } /** * Returns the directory which contains the PHP interpreter. * * @return string * The path of the directory containing the PHP interpreter. If the server * is running in a command-line interface, the directory portion of * PHP_BINARY is returned; otherwise, the compile-time PHP_BINDIR is. * * @see php_sapi_name() * @see https://www.php.net/manual/en/reserved.constants.php */ protected static function getPhpDirectory(): string { if (PHP_SAPI === 'cli' || PHP_SAPI === 'cli-server') { return dirname(PHP_BINARY); } return PHP_BINDIR; } /** * Returns the path to use as the COMPOSER_HOME environment variable. * Loading Loading
package_manager/src/ProcessFactory.php +20 −2 Original line number Diff line number Diff line Loading @@ -74,11 +74,29 @@ final class ProcessFactory implements ProcessFactoryInterface { if ($this->isComposerCommand($command)) { $env['COMPOSER_HOME'] = $this->getComposerHomePath(); } // Ensure that the running PHP binary is in the PATH. $env['PATH'] = $this->getEnv('PATH') . ':' . dirname(PHP_BINARY); // Ensure that the PHP interpreter is in the PATH. $env['PATH'] = $this->getEnv('PATH') . ':' . static::getPhpDirectory(); return $process->setEnv($env); } /** * Returns the directory which contains the PHP interpreter. * * @return string * The path of the directory containing the PHP interpreter. If the server * is running in a command-line interface, the directory portion of * PHP_BINARY is returned; otherwise, the compile-time PHP_BINDIR is. * * @see php_sapi_name() * @see https://www.php.net/manual/en/reserved.constants.php */ protected static function getPhpDirectory(): string { if (PHP_SAPI === 'cli' || PHP_SAPI === 'cli-server') { return dirname(PHP_BINARY); } return PHP_BINDIR; } /** * Returns the path to use as the COMPOSER_HOME environment variable. * Loading