yii2-queue
yii2-queue copied to clipboard
Why are environment variables not passed to the created process?!
Why are environment variables not passed to the created process?!
https://github.com/yiisoft/yii2-queue/blob/726a4fd55aecb4ccefd4957b42d28d35c3ea653e/src/cli/Command.php#L185
I use the vlucas/phpdotenv library and my entire database connection configuration is in environment variables. Why can’t you pass local variables into the running process - this will solve the problem!
$env = isset($_ENV) ? $_ENV : null;
$process = new Process($cmd, null, $env, $message, $ttr);
Will it solve what problem? Can you write more about the problem?
In my case this will solve the problem. When php yii queue/run is started, environment variables are initialized. Next, the tasks themselves are executed individually, in debaug i see yii queue/exec 18 300 (some args...) , but for some reason without environment variables. As I understand it, they are running in an individual process, why not put environment variables into it?! code above.
I think it makes sense to pass environment variables to sub-process.
强烈建议将环境变量传递给子进程!
It is strongly recommended to pass environment variables to child processes!