本文整理汇总了PHP中posix_getgid函数的典型用法代码示例。如果您正苦于以下问题:PHP posix_getgid函数的具体用法?PHP posix_getgid怎么用?PHP posix_getgid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了posix_getgid函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: check_writable_relative
function check_writable_relative($dir)
{
$uid = posix_getuid();
$gid = posix_getgid();
$user_info = posix_getpwuid($uid);
$user = $user_info['name'];
$group_info = posix_getgrgid($gid);
$group = $group_info['name'];
$fix_cmd = '. ' . _("To fix that, execute following commands as root") . ':<br><br>' . "cd " . getcwd() . "<br>" . "mkdir -p {$dir}<br>" . "chown {$user}:{$group} {$dir}<br>" . "chmod 0700 {$dir}";
if (!is_dir($dir)) {
$config_nt = array('content' => _("Required directory " . getcwd() . "{$dir} does not exist") . $fix_cmd, 'options' => array('type' => 'nf_warning', 'cancel_button' => FALSE), 'style' => 'width: 80%; margin: 20px auto;');
$nt = new Notification('nt_1', $config_nt);
$nt->show();
exit;
}
if (!($stat = stat($dir))) {
$config_nt = array('content' => _("Could not stat configs dir") . $fix_cmd, 'options' => array('type' => 'nf_warning', 'cancel_button' => FALSE), 'style' => 'width: 80%; margin: 20px auto;');
$nt = new Notification('nt_1', $config_nt);
$nt->show();
exit;
}
// 2 -> file perms (must be 0700)
// 4 -> uid (must be the apache uid)
// 5 -> gid (must be the apache gid)
if ($stat[2] != 16832 || $stat[4] !== $uid || $stat[5] !== $gid) {
$config_nt = array('content' => _("Invalid perms for configs dir") . $fix_cmd, 'options' => array('type' => 'nf_warning', 'cancel_button' => FALSE), 'style' => 'width: 80%; margin: 20px auto;');
$nt = new Notification('nt_1', $config_nt);
$nt->show();
exit;
}
}
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:view.php
示例2: _getCurrentGroup
private function _getCurrentGroup()
{
if (function_exists('posix_getgid')) {
return posix_getgid();
}
return '';
}
开发者ID:thsonvt,项目名称:sugarcrm_dev,代码行数:7,代码来源:SugarFileUtilsTest.php
示例3: doRepositoryTest
function doRepositoryTest($repo)
{
if ($repo->accessType != "ssh") {
return -1;
}
$basePath = "../../../plugins/access.ssh/";
// Check file exists
if (!file_exists($basePath . "class.sshAccessDriver.php") || !file_exists($basePath . "class.SSHOperations.php") || !file_exists($basePath . "manifest.xml") || !file_exists($basePath . "showPass.php") || !file_exists($basePath . "sshActions.xml")) {
$this->failedInfo .= "Missing at least one of the plugin files (class.sshDriver.php, class.SSHOperations.php, manifest.xml, showPass.php, sshActions.xml).\nPlease reinstall from lastest release.";
return FALSE;
}
// Check if showPass is executable from ssh
$stat = stat($basePath . "showPass.php");
$mode = $stat['mode'] & 0x7fff;
// We don't care about the type
if (!is_executable($basePath . 'showPass.php') && ($mode & 0x40 && $stat['uid'] == posix_getuid()) && ($mode & 0x8 && $stat['gid'] == posix_getgid()) && $mode & 0x1) {
chmod($basePath . 'showPass.php', 0555);
if (!is_executable($basePath . 'showPass.php')) {
$this->failedInfo .= "showPass.php must be executable. Please log in on your server and set showPass.php as executable (chmod u+x showPass.php).";
return FALSE;
}
}
// Check if ssh is accessible
$handle = popen("ssh 2>&1", "r");
$usage = fread($handle, 30);
pclose($handle);
if (strpos($usage, "usage") === FALSE) {
$this->failedInfo .= "Couldn't find or execute 'ssh' on your system. Please install latest SSH client.";
return FALSE;
}
return TRUE;
}
开发者ID:bloveing,项目名称:openulteo,代码行数:32,代码来源:test.sshAccess.php
示例4: setUp
public function setUp()
{
$this->uid = function_exists('posix_getuid') ? posix_getuid() : 0;
$this->gid = function_exists('posix_getgid') ? posix_getgid() : 0;
@$na['n/a'];
//putting error in known state
}
开发者ID:mathroc,项目名称:php-vfs,代码行数:7,代码来源:WrapperTest.php
示例5: fingerprint
function fingerprint($params = array())
{
$profile = array('os' => PHP_OS, 'system_name' => php_uname('s'), 'system_release' => php_uname('r'), 'system_version' => php_uname('v'), 'machine_type' => php_uname('m'), 'host_name' => php_uname('n'), 'php_server_api' => php_sapi_name(), 'php_version' => phpversion(), 'uid' => posix_getuid(), 'gid' => posix_getgid(), 'cwd' => getcwd(), 'disk_free_space' => disk_free_space('/'), 'disk_total_space' => disk_total_space('/'));
switch ($profile['php_server_api']) {
case 'apache':
$profile['apache_version'] = apache_get_version();
break;
}
return $profile;
}
开发者ID:ronin-ruby,项目名称:ronin-ruby.github.io,代码行数:10,代码来源:server.php
示例6: getOption
protected function getOption($name, $user = "", $pass = "")
{
$opt = $this->options[$name];
$opt = str_replace("AJXP_USER", $user, $opt);
$opt = str_replace("AJXP_PASS", "'{$pass}'", $opt);
$opt = str_replace("AJXP_SERVER_UID", posix_getuid(), $opt);
$opt = str_replace("AJXP_SERVER_GID", posix_getgid(), $opt);
if (stristr($opt, "AJXP_REPOSITORY_PATH") !== false) {
$repo = ConfService::getRepository();
$path = $repo->getOption("PATH");
$opt = str_replace("AJXP_REPOSITORY_PATH", $path, $opt);
}
return $opt;
}
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:14,代码来源:class.FilesystemMounter.php
示例7: start
function start($argv)
{
$appName = $this->appName;
if (file_exists($this->command_file())) {
unlink($this->command_file());
}
if (array_search("--background", $argv)) {
System_Daemon::setOption("appName", $appName);
System_Daemon::setOption("appRunAsUID", posix_getuid());
System_Daemon::setOption("appRunAsGID", posix_getgid());
System_Daemon::setOption("logLocation", getenv('WSETCDIR') . "/logs/{$appName}");
System_Daemon::setOption("appPidLocation", getenv('WSETCDIR') . "/pushd/{$appName}/{$appName}.pid");
System_Daemon::setOption('logPhpErrors', true);
System_Daemon::setOption('logFilePosition', true);
System_Daemon::setOption('logLinePosition', true);
System_Daemon::start();
}
}
开发者ID:jamespaulmuir,项目名称:MIT-Mobile-Framework,代码行数:18,代码来源:DaemonWrapper.php
示例8: handle
/**
* Handle an event.
*
* @param \League\Event\EventInterface $event The triggering event
*
* @return void
* @see \League\Event\ListenerInterface::handle()
*/
public function handle(EventInterface $event)
{
try {
// load the application server instance
/** @var \AppserverIo\Appserver\Core\Interfaces\ApplicationServerInterface $applicationServer */
$applicationServer = $this->getApplicationServer();
// write a log message that the event has been invoked
$applicationServer->getSystemLogger()->info($event->getName());
// don't do anything under Windows
if (FileSystem::getOsIdentifier() === 'WIN') {
$applicationServer->getSystemLogger()->info('Don\'t switch UID to \'%s\' because OS is Windows');
return;
}
// initialize the variable for user/group
$uid = 0;
$gid = 0;
// throw an exception if the POSIX extension is not available
if (extension_loaded('posix') === false) {
throw new \Exception('Can\'t switch user, because POSIX extension is not available');
}
// print a message with the old UID/EUID
$applicationServer->getSystemLogger()->info("Running as " . posix_getuid() . "/" . posix_geteuid());
// extract the user and group name as variables
extract(posix_getgrnam($applicationServer->getSystemConfiguration()->getGroup()));
extract(posix_getpwnam($applicationServer->getSystemConfiguration()->getUser()));
// switch the effective GID to the passed group
if (posix_setegid($gid) === false) {
$applicationServer->getSystemLogger()->error(sprintf('Can\'t switch GID to \'%s\'', $gid));
}
// print a message with the new GID/EGID
$applicationServer->getSystemLogger()->info("Running as group" . posix_getgid() . "/" . posix_getegid());
// switch the effective UID to the passed user
if (posix_seteuid($uid) === false) {
$applicationServer->getSystemLogger()->error(sprintf('Can\'t switch UID to \'%s\'', $uid));
}
// print a message with the new UID/EUID
$applicationServer->getSystemLogger()->info("Running as user " . posix_getuid() . "/" . posix_geteuid());
} catch (\Exception $e) {
$applicationServer->getSystemLogger()->error($e->__toString());
}
}
开发者ID:jinchunguang,项目名称:appserver,代码行数:49,代码来源:SwitchUserListener.php
示例9: check_writable_relative
function check_writable_relative($dir)
{
$uid = posix_getuid();
$gid = posix_getgid();
$user_info = posix_getpwuid($uid);
$user = $user_info['name'];
$group_info = posix_getgrgid($gid);
$group = $group_info['name'];
$fix_cmd = '. ' . _("To fix that, execute following commands as root") . ':<br><br>' . "cd " . getcwd() . "<br>" . "mkdir -p {$dir}<br>" . "chown {$user}:{$group} {$dir}<br>" . "chmod 0700 {$dir}";
if (!is_dir($dir)) {
die(_("Required directory " . getcwd() . "{$dir} does not exist") . $fix_cmd);
}
$fix_cmd .= $fix_extra;
if (!($stat = stat($dir))) {
die(_("Could not stat configs dir") . $fix_cmd);
}
// 2 -> file perms (must be 0700)
// 4 -> uid (must be the apache uid)
// 5 -> gid (must be the apache gid)
if ($stat[2] != 16832 || $stat[4] !== $uid || $stat[5] !== $gid) {
die(_("Invalid perms for configs dir") . $fix_cmd);
}
}
开发者ID:jhbsz,项目名称:ossimTest,代码行数:23,代码来源:view.php
示例10: changeIdentity
/**
* Method to change the identity of the daemon process and resources.
*
* @return boolean True if identity successfully changed
*
* @since 11.1
* @see posix_setuid()
*/
protected function changeIdentity()
{
// Get the group and user ids to set for the daemon.
$uid = (int) $this->config->get('application_uid', 0);
$gid = (int) $this->config->get('application_gid', 0);
// Get the application process id file path.
$file = $this->config->get('application_pid_file');
// Change the user id for the process id file if necessary.
if ($uid && fileowner($file) != $uid && !@chown($file, $uid)) {
JLog::add('Unable to change user ownership of the process id file.', JLog::ERROR);
return false;
}
// Change the group id for the process id file if necessary.
if ($gid && filegroup($file) != $gid && !@chgrp($file, $gid)) {
JLog::add('Unable to change group ownership of the process id file.', JLog::ERROR);
return false;
}
// Set the correct home directory for the process.
if ($uid && ($info = posix_getpwuid($uid)) && is_dir($info['dir'])) {
system('export HOME="' . $info['dir'] . '"');
}
// Change the user id for the process necessary.
if ($uid && posix_getuid($file) != $uid && !@posix_setuid($uid)) {
JLog::add('Unable to change user ownership of the proccess.', JLog::ERROR);
return false;
}
// Change the group id for the process necessary.
if ($gid && posix_getgid($file) != $gid && !@posix_setgid($gid)) {
JLog::add('Unable to change group ownership of the proccess.', JLog::ERROR);
return false;
}
// Get the user and group information based on uid and gid.
$user = posix_getpwuid($uid);
$group = posix_getgrgid($gid);
JLog::add('Changed daemon identity to ' . $user['name'] . ':' . $group['name'], JLog::INFO);
return true;
}
开发者ID:raquelsa,项目名称:Joomla,代码行数:45,代码来源:daemon.php
示例11: getFilePermissionsReturnsCorrectPermissionsForFilesNotOwnedByCurrentUser_dataProvider
/**
* Dataprovider for getFilePermissionsReturnsCorrectPermissionsForFilesNotOwnedByCurrentUser test
*
* @return array group, filemode and expected result
*/
public function getFilePermissionsReturnsCorrectPermissionsForFilesNotOwnedByCurrentUser_dataProvider()
{
$data = array();
// On some OS, the posix_* functions do not exits
if (function_exists('posix_getgid')) {
$data = array('current group, readable/writable' => array(posix_getgid(), 48, array('r' => TRUE, 'w' => TRUE)), 'current group, readable/not writable' => array(posix_getgid(), 32, array('r' => TRUE, 'w' => FALSE)), 'current group, not readable/not writable' => array(posix_getgid(), 0, array('r' => FALSE, 'w' => FALSE)));
}
$data = array_merge_recursive($data, array('arbitrary group, readable/writable' => array(vfsStream::GROUP_USER_1, 6, array('r' => TRUE, 'w' => TRUE)), 'arbitrary group, readable/not writable' => array(vfsStream::GROUP_USER_1, 436, array('r' => TRUE, 'w' => FALSE)), 'arbitrary group, not readable/not writable' => array(vfsStream::GROUP_USER_1, 432, array('r' => FALSE, 'w' => FALSE))));
return $data;
}
开发者ID:Mr-Robota,项目名称:TYPO3.CMS,代码行数:15,代码来源:LocalDriverTest.php
示例12: getGid
public function getGid()
{
if (null === $this->_gid) {
if (function_exists('posix_getgid')) {
$this->_gid = posix_getgid();
} else {
// Find another way to do it?
$this->_gid = false;
}
}
return $this->_gid;
}
开发者ID:febryantosulistyo,项目名称:ClassicSocial,代码行数:12,代码来源:System.php
示例13: posix_getgid
<?php
echo "Basic test of POSIX getgid and getgrid fucntions\n";
$gid = posix_getgid();
$groupinfo = posix_getgrgid($gid);
print_r($groupinfo);
?>
===DONE===
开发者ID:badlamer,项目名称:hhvm,代码行数:8,代码来源:posix_getgrgid_basic.php
示例14: posix_getgrgid
<?php
if (!$cfg->error) {
?>
<form action="step1.php">
<input type="submit" value="Go to step one: Pre flight check" />
</form>
<?php
} else {
if (!$cfg->cacheCheck) {
?>
<div class="error">
The template compile dir must be writable.<br />A quick solution is to run: <br />
<?php
echo 'chmod 777 ' . SMARTY_DIR . 'templates_c';
if (extension_loaded('posix') && strtolower(substr(PHP_OS, 0, 3)) !== 'win') {
$group = posix_getgrgid(posix_getgid());
echo '<br /><br />Another solution is to run:<br />chown -R YourUnixUserName:' . $group['name'] . ' ' . nZEDb_ROOT . '<br />Then give your user access to the group:<br />usermod -a -G ' . $group['name'] . ' YourUnixUserName' . '<br />Finally give read/write access to your user/group:<br />chmod -R 774 ' . nZEDb_ROOT;
}
?>
</div>
<?php
} else {
?>
<div class="error">Installation Locked! If reinstalling, please remove www/install/install.lock.</div>
<?php
}
}
?>
</div>
<div class="footer">
开发者ID:EeGgSs,项目名称:nZEDb,代码行数:31,代码来源:index.php
示例15: posix_getgrnam
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
***********************************************************/
/**
* @file migratetest.php
* @brief Test migration function
*
* @return 0 for success, 1 for failure.
**/
/* User must be in group fossy! */
$GID = posix_getgrnam("fossy");
posix_setgid($GID['gid']);
$Group = `groups`;
if (!preg_match("/\\sfossy\\s/", $Group) && posix_getgid() != $GID['gid']) {
print "FATAL: You must be in group 'fossy' to update the FOSSology database.\n";
exit(1);
}
/* Initialize the program configuration variables */
$SysConf = array();
// fo system configuration variables
$PG_CONN = 0;
// Database connection
$Plugins = array();
/* defaults */
$Verbose = false;
$DatabaseName = "fossology";
$UpdateLiceneseRef = false;
$sysconfdir = '/usr/local/etc/fossology';
/* Set SYSCONFDIR and set global (for backward compatibility) */
开发者ID:pombredanne,项目名称:fossology-test,代码行数:30,代码来源:migratetest.php
示例16: posix_getpwuid
echo " <table width=100% height=100% border=0 cellpadding=10 cellspacing=1>\n";
echo " <tr class=right_main_text>\n";
echo " <td valign=top>\n";
if ($disable_sysedit == "yes") {
echo " <table width=100% border=0 cellpadding=0 cellspacing=0>\n";
echo " <tr><td height=25 class=table_rows_red>This page has been <b>disabled</b> within config.inc.php.</td></tr>";
echo " </table></td></tr>\n";
include '../footer.php';
exit;
}
if (!is_writable($filename)) {
if (PHP_OS != 'WIN32') {
$user = posix_getpwuid(fileowner($filename));
$group = posix_getgrgid(filegroup($filename));
$process_user = posix_getpwuid(posix_getuid());
$process_group = posix_getgrgid(posix_getgid());
echo " <table width=100% border=0 cellpadding=0 cellspacing=0>\n";
echo " <tr><td height=25 class=table_rows_red>The PHP Timeclock config file, config.inc.php, <b><i>is not writable</i></b> by your webserver\n user: ";
echo "<b>";
echo $process_user['name'];
echo "</b>.<b>";
echo $process_group['name'];
echo "</b> (user.group).</td></tr>\n";
echo " <tr><td height=25 class=table_rows_red>To edit the System Settings within PHP Timeclock, either change the permissions\n on config.inc.php for this user, or assign this file to another owner, preferably your webserver user.</td></tr>\n";
echo " <tr><td height=25 class=table_rows_red> Current owner of config.inc.php is <b>";
echo $user["name"];
echo "</b>.<b>";
echo $group["name"];
echo "</b> (user.group).</td></tr>\n";
echo " </table></td></tr>\n";
include '../footer.php';
开发者ID:benscanfiles,项目名称:timeclock,代码行数:31,代码来源:sysedit.php
示例17: _changeIdentity
/**
* Change identity of process & resources if needed.
*
* @param integer $gid Group identifier (number)
* @param integer $uid User identifier (number)
*
* @return boolean
*/
protected function _changeIdentity($gid = 0, $uid = 0)
{
// What files need to be chowned?
$chownFiles = array();
if ($this->_isValidPidLocation($this->opt('appPidLocation'), true)) {
$chownFiles[] = dirname($this->opt('appPidLocation'));
}
$chownFiles[] = $this->opt('appPidLocation');
if (!is_object($this->opt('usePEARLogInstance'))) {
$chownFiles[] = $this->opt('logLocation');
}
// Chown pid- & log file
// We have to change owner in case of identity change.
// This way we can modify the files even after we're not root anymore
foreach ($chownFiles as $filePath) {
// Change File GID
$doGid = filegroup($filePath) != $gid ? $gid : false;
if (false !== $doGid && !@chgrp($filePath, intval($gid))) {
return $this->err('Unable to change group of file %s to %s', $filePath, $gid);
}
// Change File UID
$doUid = fileowner($filePath) != $uid ? $uid : false;
if (false !== $doUid && !@chown($filePath, intval($uid))) {
return $this->err('Unable to change user of file %s to %s', $filePath, $uid);
}
// Export correct homedir
if (($info = posix_getpwuid($uid)) && is_dir($info['dir'])) {
system('export HOME="' . $info['dir'] . '"');
}
}
// Change Process GID
$doGid = posix_getgid() !== $gid ? $gid : false;
if (false !== $doGid && !@posix_setgid($gid)) {
return $this->err('Unable to change group of process to %s', $gid);
}
// Change Process UID
$doUid = posix_getuid() !== $uid ? $uid : false;
if (false !== $doUid && !@posix_setuid($uid)) {
return $this->err('Unable to change user of process to %s', $uid);
}
$group = posix_getgrgid($gid);
$user = posix_getpwuid($uid);
return $this->info('Changed identify to %s:%s', $group['name'], $user['name']);
}
开发者ID:uecode,项目名称:daemon,代码行数:52,代码来源:Daemon.php
示例18: parseAndOutputPreconfig
//.........这里部分代码省略.........
$question .= '<li>' . $idna_convert->decode($domain) . '</li>';
}
$question .= '</ul>';
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
}
if (versionInUpdate($current_version, '0.9.9-svn1')) {
$has_preconfig = true;
$description = 'When entering MX servers to Froxlor there was no mail-, imap-, pop3- and smtp-"A record" created. You can now chose whether this should be done or not.';
$question = '<strong>Do you want these A-records to be created even with MX servers given?:</strong> ';
$question .= makeyesno('update_defdns_mailentry', '1', '0', '0');
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
if (versionInUpdate($current_version, '0.9.10-svn1')) {
$has_nouser = false;
$has_nogroup = false;
$result_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'system' AND `varname` = 'httpuser'");
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if (!isset($result) || !isset($result['value'])) {
$has_preconfig = true;
$has_nouser = true;
$guessed_user = 'www-data';
if (function_exists('posix_getuid') && function_exists('posix_getpwuid')) {
$_httpuser = posix_getpwuid(posix_getuid());
$guessed_user = $_httpuser['name'];
}
}
$result_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup` = 'system' AND `varname` = 'httpgroup'");
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if (!isset($result) || !isset($result['value'])) {
$has_preconfig = true;
$has_nogroup = true;
$guessed_group = 'www-data';
if (function_exists('posix_getgid') && function_exists('posix_getgrgid')) {
$_httpgroup = posix_getgrgid(posix_getgid());
$guessed_group = $_httpgroup['name'];
}
}
if ($has_nouser || $has_nogroup) {
$description = 'Please enter the correct username/groupname of the webserver on your system We\'re guessing the user but it might not be correct, so please check.';
if ($has_nouser) {
$question = '<strong>Please enter the webservers username:</strong> <input type="text" class="text" name="update_httpuser" value="' . $guessed_user . '" />';
} elseif ($has_nogroup) {
$question2 = '<strong>Please enter the webservers groupname:</strong> <input type="text" class="text" name="update_httpgroup" value="' . $guessed_group . '" />';
if ($has_nouser) {
$question .= '<br /><br />' . $question2;
} else {
$question = $question2;
}
}
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
}
if (versionInUpdate($current_version, '0.9.10')) {
$has_preconfig = true;
$description = 'you can now decide whether Froxlor should be reached via hostname/froxlor or directly via the hostname.';
$question = '<strong>Do you want Froxlor to be reached directly via the hostname?:</strong> ';
$question .= makeyesno('update_directlyviahostname', '1', '0', '0');
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
if (versionInUpdate($current_version, '0.9.11-svn1')) {
$has_preconfig = true;
$description = 'It is possible to enhance security with setting a regular expression to force your customers to enter more complex passwords.';
$question = '<strong>Enter a regular expression to force a higher password complexity (leave empty for none):</strong> ';
$question .= '<input type="text" class="text" name="update_pwdregex" value="" />';
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
开发者ID:greybyte,项目名称:froxlor-mn,代码行数:67,代码来源:preconfig_0.9.inc.php
示例19: eZSetupPrvPosixExtension
function eZSetupPrvPosixExtension()
{
$userInfo = array('has_extension' => false);
if (extension_loaded('posix')) {
$userInfo['has_extension'] = true;
$uinfo = posix_getpwuid(posix_getuid());
$ginfo = posix_getgrgid(posix_getgid());
$userInfo['user_name'] = $uinfo['name'];
$userInfo['user_id'] = $uinfo['uid'];
$userInfo['group_name'] = $ginfo['name'];
$userInfo['group_id'] = $ginfo['gid'];
$userInfo['group_members'] = $ginfo['members'];
$userInfo['script_user_id'] = getmyuid();
$userInfo['script_group_id'] = getmygid();
}
return $userInfo;
}
开发者ID:runelangseid,项目名称:ezpublish,代码行数:17,代码来源:ezsetuptests.php
示例20: run
/**
* Called when request iterated.
* @return integer Status.
*/
public function run()
{
$stime = microtime(TRUE);
$this->header('Content-Type: text/html');
$this->setcookie('testcookie', '1');
$this->registerShutdownFunction(function () {
?>
</html><?php
});
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>It works!</title>
</head>
<body>
<h1>It works! Be happy! ;-)</h1>
Hello world!
<br />Counter of requests to this Application Instance: <b><?php
echo ++$this->appInstance->counter;
?>
</b>
<br />Memory usage: <?php
$mem = memory_get_usage();
echo $mem / 1024 / 1024;
?>
MB. (<?php
echo $mem;
?>
)
<br />Memory real usage: <?php
$mem = memory_get_usage(TRUE);
echo $mem / 1024 / 1024;
?>
MB. (<?php
echo $mem;
?>
)
<br />Pool size: <?php
echo sizeof(Daemon::$process->pool);
?>
.
<br />My PID: <?php
echo getmypid();
?>
.
<?php
$user = posix_getpwuid(posix_getuid());
$group = posix_getgrgid(posix_getgid());
?>
<br />My user/group: <?php
echo $user['name'] . '/' . $group['name'];
$displaystate = TRUE;
if ($displaystate) {
?>
<br /><br /><b>State of workers:</b><?php
$stat = Daemon::getStateOfWorkers();
?>
<br />Idle: <?php
echo $stat['idle'];
?>
<br />Busy: <?php
echo $stat['busy'];
?>
<br />Total alive: <?php
echo $stat['alive'];
?>
<br />Shutdown: <?php
echo $stat['shutdown'];
?>
<br />Pre-init: <?php
echo $stat['preinit'];
?>
<br />Wait-init: <?php
echo $stat['waitinit'];
?>
<br />Init: <?php
echo $stat['init'];
?>
<br />
<?php
}
?>
<br /><br />
<br /><br /><form action="<?php
echo htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES);
?>
" method="post" enctype="multipart/form-data">
<input type="file" name="myfile" />
<input type="submit" name="submit" value="Upload" />
</form>
<br />
<form action="<?php
echo htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES);
?>
//.........这里部分代码省略.........
开发者ID:J3FF3,项目名称:phpdaemon,代码行数:101,代码来源:Example.php
注:本文中的posix_getgid函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论