|
|
|
|
|
by CaveTech
3021 days ago
|
|
PHP has an execution model that's /really/ bad for per-process requests. Even attempting to grab the parent pid is probably not sufficient as you can have execution contexts with no parent (ex: running php from cron). On linux you can get the master process through posix-getppid (http://php.net/manual/en/function.posix-getppid.php) but this won't work on windows and has the same limitations as above. Have you thought about having a linux daemon/agent that runs in the background and keeps the ENV in sync? |
|
Another option would be to add EnvKey support to confd (or similar project), and provide config and template files that write the env vars to Apache and Nginx configs, and reload when they change.
Though neither confd or a daemon would work for PHP sites that use a PaaS or shared hosting, which I think is a large percentage of the market for PHP.
Using one of the existing PHP caching solutions (like opcache) might be an option.