Skip to content

Automatic HOME directory detection #8

@bethrezen

Description

@bethrezen

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.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions