Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f079cb6

Browse filesBrowse files
committed
feature #28303 [Process] Add relative path support for PHP_BINARY env var of PhpExecutableFinder (maidmaid)
This PR was merged into the 4.2-dev branch. Discussion ---------- [Process] Add relative path support for PHP_BINARY env var of PhpExecutableFinder | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | / | License | MIT | Doc PR | / At the moment, only the absolute path for PHP_BINARY env var works, for instance : ``` $ PHP_BINARY=/usr/bin/php7.2 php bin/console server:run [OK] Server listening on http://127.0.0.1:8000 $ PHP_BINARY=php7.2 php bin/console server:run [ERROR] Unable to find the PHP binary. ``` This PR makes possible the second command. Commits ------- 52ed9889af Add relative path support for PHP_BINARY env var of PhpExecutableFinder
2 parents d908dbd + 3a173ff commit f079cb6
Copy full SHA for f079cb6

File tree

Expand file treeCollapse file tree

1 file changed

+8
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-1
lines changed

‎PhpExecutableFinder.php

Copy file name to clipboardExpand all lines: PhpExecutableFinder.php
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,14 @@ public function find($includeArgs = true)
3737
{
3838
if ($php = getenv('PHP_BINARY')) {
3939
if (!is_executable($php)) {
40-
return false;
40+
$command = '\\' === \DIRECTORY_SEPARATOR ? 'where' : 'command -v';
41+
if ($php = strtok(exec($command.' '.escapeshellarg($php)), PHP_EOL)) {
42+
if (!is_executable($php)) {
43+
return false;
44+
}
45+
} else {
46+
return false;
47+
}
4148
}
4249

4350
return $php;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.