When my PHP script runs a subprocess (with any of the relevant functions such as exec()
, system()
, passthru()
, popen()
, proc_open()
, and maybe others I've forgotten) I can control the values of environment variables the process starts with (either by changing the script's environment itself, or, at least in the case of proc_open()
, by passing the desired environment as an argument). But is there a way for my script to get the state of the environment the process finishes with (that is the process potentially changes the environment, and I wish my script to be able to track those changes). Using getenv()
is useless as the script`s environment is not changed by the subprocess. Any ideas regarding whether this can be done, and how?