The $ env argument for proc_open replaces the current environment, but if it is NULL, the environment of the current process is used.
A possible solution would be to use putenv () to change the current environment instead of specifying a new array for $ env. Let environment inheritance work.
I came across this problem specifically, using the symphony / process component to start the PHP process. Everything worked fine on Linux, but the process failed on Windows servers without network access. Using putenv () and NULL for $ env worked fine in both cases of the OS and solved the problem. The effect of putenv () lasts only for the duration of the request that issues it, so it should be safe if your changes will not cause problems with the rest of your script, or there is material in your current environment that should not be visible in the process that opens.
I searched my way here, looking for answers, and the information definitely helped me in the decision. It may have been too long to help the original poster, but perhaps it can help the next person.
rgriff59
source share