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

Why are environment variables not passed to the created process?! #493

Open
mymagikbox opened this issue Sep 21, 2023 · 5 comments
Open
Labels
status:ready for adoption Feel free to implement this issue. type:enhancement Enhancement

Comments

@mymagikbox
Copy link

Why are environment variables not passed to the created process?!

$process = new Process($cmd, null, null, $message, $ttr);

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);

@s1lver
Copy link
Member

s1lver commented Sep 22, 2023

Will it solve what problem? Can you write more about the problem?

@mymagikbox
Copy link
Author

mymagikbox commented Sep 22, 2023

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.

@samdark samdark added the type:enhancement Enhancement label Oct 19, 2023
@samdark
Copy link
Member

samdark commented Oct 19, 2023

I think it makes sense to pass environment variables to sub-process.

@over-star
Copy link

强烈建议将环境变量传递给子进程!

@over-star
Copy link

It is strongly recommended to pass environment variables to child processes!

@samdark samdark added the status:ready for adoption Feel free to implement this issue. label Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:ready for adoption Feel free to implement this issue. type:enhancement Enhancement
Projects
None yet
Development

No branches or pull requests

4 participants