Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic HOME directory detection #8

Open
bethrezen opened this issue Feb 9, 2016 · 0 comments
Open

Automatic HOME directory detection #8

bethrezen opened this issue Feb 9, 2016 · 0 comments
Assignees

Comments

@bethrezen
Copy link
Member

On posix systems we can try to call posix_getpwuid:

php > var_dump(posix_getpwuid(posix_getuid()));
array(7) {
  'name' =>
  string(9) "bethrezen"
  'passwd' =>
  string(8) "********"
  'uid' =>
  int(501)
  'gid' =>
  int(20)
  'gecos' =>
  string(21) "Alexander Kozhevnikov"
  'dir' =>
  string(16) "/Users/bethrezen"
  'shell' =>
  string(8) "/bin/zsh"
}

Home directory is in dir.
Some additional checks like if we running posix OS or if dir is filled are needed too.
If we haven't set home directory with Yii::$app->params['deferred.env'] and it is determined with such method - use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants