PluginProbe
ManageWP Worker / 4.9.25
ManageWP Worker v4.9.25
4.9.38 4.9.37 4.9.36 4.9.35 4.9.34 3.8.7 3.8.8 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.18 3.9.19 3.9.2 3.9.20 3.9.21 3.9.22 3.9.23 3.9.24 All 73 releases
worker / src / Symfony / Process / PhpExecutableFinder.php

PhpExecutableFinder.php in ManageWP Worker 4.9.25, at src/Symfony/Process/PhpExecutableFinder.php

85 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 /**
13 * An executable finder specifically designed for the PHP executable.
14 *
15 * @author Fabien Potencier <fabien@symfony.com>
16 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
17 */
18 class Symfony_Process_PhpExecutableFinder
19 {
20 private $executableFinder;
21
22 public function __construct()
23 {
24 $this->executableFinder = new Symfony_Process_ExecutableFinder();
25 }
26
27 /**
28 * Finds The PHP executable.
29 *
30 * @param bool $includeArgs Whether or not include command arguments
31 *
32 * @return string|false The PHP executable path or false if it cannot be found
33 */
34 public function find($includeArgs = true)
35 {
36 // HHVM support
37 if (defined('HHVM_VERSION')) {
38 return (false !== ($hhvm = getenv('PHP_BINARY')) ? $hhvm : PHP_BINARY).($includeArgs ? ' '.implode(' ', $this->findArguments()) : '');
39 }
40
41 // PHP_BINARY return the current sapi executable
42 if (defined('PHP_BINARY') && PHP_BINARY && in_array(PHP_SAPI, array('cli', 'cli-server')) && is_file(PHP_BINARY)) {
43 return PHP_BINARY;
44 }
45
46 if ($php = getenv('PHP_PATH')) {
47 if (!is_executable($php)) {
48 return false;
49 }
50
51 return $php;
52 }
53
54 if ($php = getenv('PHP_PEAR_PHP_BIN')) {
55 if (is_executable($php)) {
56 return $php;
57 }
58 }
59
60 $dirs = array(PHP_BINDIR);
61 if (Symfony_Process_ProcessUtils::isWindows()) {
62 $dirs[] = 'C:\xampp\php\\';
63 }
64
65 return $this->executableFinder->find('php', false, $dirs);
66 }
67
68 /**
69 * Finds the PHP executable arguments.
70 *
71 * @return array The PHP executable arguments
72 */
73 public function findArguments()
74 {
75 $arguments = array();
76
77 // HHVM support
78 if (defined('HHVM_VERSION')) {
79 $arguments[] = '--php';
80 }
81
82 return $arguments;
83 }
84 }
85