本文整理汇总了PHP中PHPDaemon\Core\Daemon::appResolver方法的典型用法代码示例。如果您正苦于以下问题:PHP Daemon::appResolver方法的具体用法?PHP Daemon::appResolver怎么用?PHP Daemon::appResolver使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPDaemon\Core\Daemon
的用法示例。
在下文中一共展示了Daemon::appResolver方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
//.........这里部分代码省略.........
Daemon::log('[EMERG] You must set \'path\' parameter (path to your application resolver).');
$error = true;
}
if (!file_exists(Daemon::$config->pidfile->value)) {
if (!touch(Daemon::$config->pidfile->value)) {
Daemon::log('[EMERG] Couldn\'t create pid-file \'' . Daemon::$config->pidfile->value . '\'.');
$error = true;
}
Bootstrap::$pid = 0;
} elseif (!is_file(Daemon::$config->pidfile->value)) {
Daemon::log('Pid-file \'' . Daemon::$config->pidfile->value . '\' must be a regular file.');
Bootstrap::$pid = FALSE;
$error = true;
} elseif (!is_writable(Daemon::$config->pidfile->value)) {
Daemon::log('Pid-file \'' . Daemon::$config->pidfile->value . '\' must be writable.');
$error = true;
} elseif (!is_readable(Daemon::$config->pidfile->value)) {
Daemon::log('Pid-file \'' . Daemon::$config->pidfile->value . '\' must be readable.');
Bootstrap::$pid = FALSE;
$error = true;
} else {
Bootstrap::$pid = (int) file_get_contents(Daemon::$config->pidfile->value);
}
if (Daemon::$config->chroot->value !== '/') {
if (posix_getuid() != 0) {
Daemon::log('You must have the root privileges to change root.');
$error = true;
}
}
$pathList = preg_split('~\\s*;\\s*~', Daemon::$config->path->value);
$found = false;
foreach ($pathList as $path) {
if (@is_file($path)) {
Daemon::$appResolverPath = $path;
$found = true;
break;
}
}
if (!$found) {
Daemon::log('Your application resolver \'' . Daemon::$config->path->value . '\' is not available (config directive \'path\').');
$error = true;
}
Daemon::$appResolver = (require Daemon::$appResolverPath);
if (isset(Daemon::$config->group->value) && is_callable('posix_getgid')) {
if (($sg = posix_getgrnam(Daemon::$config->group->value)) === FALSE) {
Daemon::log('Unexisting group \'' . Daemon::$config->group->value . '\'. You have to replace config-variable \'group\' with existing group-name.');
$error = true;
} elseif ($sg['gid'] != posix_getgid() && posix_getuid() != 0) {
Daemon::log('You must have the root privileges to change group.');
$error = true;
}
}
if (isset(Daemon::$config->user->value) && is_callable('posix_getuid')) {
if (($su = posix_getpwnam(Daemon::$config->user->value)) === FALSE) {
Daemon::log('Unexisting user \'' . Daemon::$config->user->value . '\', user not found. You have to replace config-variable \'user\' with existing username.');
$error = true;
} elseif ($su['uid'] != posix_getuid() && posix_getuid() != 0) {
Daemon::log('You must have the root privileges to change user.');
$error = true;
}
}
if (isset(Daemon::$config->minspareworkers->value) && Daemon::$config->minspareworkers->value > 0 && isset(Daemon::$config->maxspareworkers->value) && Daemon::$config->maxspareworkers->value > 0) {
if (Daemon::$config->minspareworkers->value > Daemon::$config->maxspareworkers->value) {
Daemon::log('\'minspareworkers\' cannot be greater than \'maxspareworkers\'.');
$error = true;
}