[Process] Make PhpExecutableFinder look for the PHP_BINARY env var

This commit is contained in:
Nicolas Grekas 2017-12-29 22:24:25 +01:00
parent cf898572a0
commit 4bd01f252f
2 changed files with 9 additions and 0 deletions

View File

@ -5,6 +5,7 @@ CHANGELOG
----- -----
* added the `Process::isTtySupported()` method that allows to check for TTY support * added the `Process::isTtySupported()` method that allows to check for TTY support
* made `PhpExecutableFinder` look for the `PHP_BINARY` env var when searching the php binary
4.0.0 4.0.0
----- -----

View File

@ -35,6 +35,14 @@ class PhpExecutableFinder
*/ */
public function find($includeArgs = true) public function find($includeArgs = true)
{ {
if ($php = getenv('PHP_BINARY')) {
if (!is_executable($php)) {
return false;
}
return $php;
}
$args = $this->findArguments(); $args = $this->findArguments();
$args = $includeArgs && $args ? ' '.implode(' ', $args) : ''; $args = $includeArgs && $args ? ' '.implode(' ', $args) : '';