From 1e69076d7a12d571dbc0b971b8e95221ed2e3b2c Mon Sep 17 00:00:00 2001 From: Pascal Borreli Date: Sun, 27 Mar 2011 20:27:03 +0000 Subject: [PATCH 1/2] [Process] Removed useless getenv --- src/Symfony/Component/Process/PhpProcess.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Process/PhpProcess.php b/src/Symfony/Component/Process/PhpProcess.php index 34078e0aa659..a4cf2b84806a 100644 --- a/src/Symfony/Component/Process/PhpProcess.php +++ b/src/Symfony/Component/Process/PhpProcess.php @@ -78,8 +78,8 @@ public function run($callback = null) */ private function getPhpBinary() { - if (getenv('PHP_PATH')) { - if (!is_executable($php = getenv('PHP_PATH'))) { + if ($php = getenv('PHP_PATH')) { + if (!is_executable($php)) { throw new \RuntimeException('The defined PHP_PATH environment variable is not a valid PHP executable.'); } From ef447dc487ab6b5e58a765e5eeda9905e8484825 Mon Sep 17 00:00:00 2001 From: Pascal Borreli Date: Sun, 27 Mar 2011 20:30:21 +0000 Subject: [PATCH 2/2] [Process] Better guess of php bin executable path If PHP_PATH is not defined (default) PHP_BINDIR is used to guess exe, but on windows this constant seems to be hardcoded and doesn't point to the good folder So before to throw an error we check if PEAR is installed, most of the case it is, and it will have good php bin path for sure. --- src/Symfony/Component/Process/PhpProcess.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Symfony/Component/Process/PhpProcess.php b/src/Symfony/Component/Process/PhpProcess.php index a4cf2b84806a..628b3f3f402b 100644 --- a/src/Symfony/Component/Process/PhpProcess.php +++ b/src/Symfony/Component/Process/PhpProcess.php @@ -93,6 +93,12 @@ private function getPhpBinary() } } + if ($php = getenv('PHP_PEAR_PHP_BIN')) { + if (is_executable($php)) { + return $php; + } + } + throw new \RuntimeException('Unable to find the PHP executable.'); } }