Skip to content

Instantly share code, notes, and snippets.

@mageekguy
Created December 14, 2011 13:26
Show Gist options
  • Save mageekguy/1476560 to your computer and use it in GitHub Desktop.
Save mageekguy/1476560 to your computer and use it in GitHub Desktop.
public function getPhpPath()
{
if ($this->phpPath === null)
{
if (isset($this->superglobals->_SERVER['_']) === true)
{
$this->setPhpPath($this->superglobals->_SERVER['_']);
}
else
{
if (DIRECTORY_SEPARATOR === '/')
{
$phpPath = PHP_BINDIR . '/php';
}
else
{
$phpPath = getenv('PHP_PEAR_PHP_BIN');
if ($phpPath === false)
{
$phpPath = getenv('PHPBIN');
}
}
if ($this->adapter->is_executable($phpPath) === false)
{
throw new exceptions\runtime('Unable to find PHP executable');
}
$this->setPhpPath($phpPath);
}
}
return $this->phpPath;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment