Changeset 2805
- Timestamp:
- 11/25/06 08:14:46 (2 years ago)
- Files:
-
- tools/lime/lib/lime.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
tools/lime/lib/lime.php
r2761 r2805 362 362 if (!is_executable($this->php_cli)) 363 363 { 364 // search in PATH 365 require_once('System.php'); 366 foreach (array('php5', 'php') as $php_cli) 367 { 368 if ($this->php_cli = System::which($php_cli)) 369 { 370 break; 371 } 372 } 373 374 if (!is_executable($this->php_cli)) 375 { 376 throw new Exception("Unable to find PHP executable."); 377 } 364 $this->php_cli = $this->find_php_cli(); 378 365 } 379 366 380 367 $this->output = $output_instance ? $output_instance : new lime_output(); 368 } 369 370 protected function find_php_cli() 371 { 372 $path = getenv('PATH') ? getenv('PATH') : getenv('Path'); 373 $exe_suffixes = OS_WINDOWS ? (getenv('PATHEXT') ? explode(PATH_SEPARATOR, getenv('PATHEXT')) : array('.exe', '.bat', '.cmd', '.com')) : array(); 374 foreach (array('php5', 'php') as $php_cli) 375 { 376 foreach ($exe_suffixes as $suffix) 377 { 378 foreach (explode(PATH_SEPARATOR, $path) as $dir) 379 { 380 $file = $dir.DIRECTORY_SEPARATOR.$php_cli.$suffix; 381 if (is_executable($file)) 382 { 383 return $file; 384 } 385 } 386 } 387 } 388 389 throw new Exception("Unable to find PHP executable."); 381 390 } 382 391