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.
On posix systems we can try to call posix_getpwuid:
Home directory is in
dir.Some additional checks like if we running posix OS or if
diris 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.