_exec('id', $output); $uid = $this->egrep('/uid=[0-9]+/', isset($output[0]) ? $output[0] : ''); $uid = $this->egrep('/[0-9]+/', $uid); return $uid; } public function getGid() { $output = null; $return = $this->_exec('id', $output); $uid = $this->egrep('/gid=[0-9]+/', isset($output[0]) ? $output[0] : ''); $uid = $this->egrep('/[0-9]+/', $uid); return $uid; } /********************************************************************************* * * Interface required functions * *********************************************************************************/ public function getName($default = 'PHP') { if (defined('HHVM_VERSION')) { return 'HHVM'; } return $default; } public function getVersion() { if (defined('HHVM_VERSION')) { return HHVM_VERSION . ' php-'.str_replace('-hhvm', '', phpversion()); } else { return phpversion(); } } /********************************************************************************* * * Private functions * *********************************************************************************/ /** * Executes shell commands on the PHP-FPM Host * * @param string $cmd Command * @param string $output Reference to output * @return integer */ private function _exec($cmd, &$output = '') { // Clean output $output = ''; exec($cmd, $output, $exit_code); return $exit_code; } }