There is a problem with the supervisor daemon php process executing getenv ('HOME')

supervisord profile

[program:satis]
command=/usr/local/webserver/php-7.1.15/bin/php artisan queue:work --sleep=3 --tries=2 --daemon
user=www

start supervisord as a root user

then add

to the php
echo exec("whoami"); // output: www

outputs www , but adds

echo getenv("HOME"); // output: /root

gets / root . If you execute

as a www user
php -r "echo getenv("HOME");" 

is / home/www .

I would like to ask why the supervisord executes the php file (starts the supervisord, configuration user www under the root user) and executes getenv ("HOME") will get / root ?

Feb.26,2021

I understand that configuring the user to www, simply tells supervisor to run as the www user when starting the script, but does not perform operations such as su-www itself. So, in fact, the system environment variable did not switch to the past, echo $HOME, it will still output / root . After all, you started the service in root.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bdf71b-31458.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bdf71b-31458.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?