As was determined in the comments above, this was caused by an environmental difference – the HOME
env var was set differently inside the executed process. Using proc_open
instead of simple exec
gave more precise control over said process and explicitly setting that env var solved the issue.