centos - How to get PHP to be able to read system environment variables -


i using php php-fpm on centos. trying follow http://12factor.net/ guidelines of having settings stored in environment variables.

i have created file in /etc/profile.d sets environment variables want, , environment variables appear when tested in cli via bash i.e. running bash script:

echo $some_server_setting 

shows correct output.

i have set clear_env setting false , variables_order egpcs, however, variable have set not show in php either getenv('some_server_setting') or doing var_dump($_env)

what other setting needs set allow php-fpm receive of server environment variables, , in particular set through shell script in /etc/profiles.d on centos?

security reasons :-)

see /etc/php5/fpm/pool.d/www.conf (debian location, may different on centos)

; clear environment in fpm workers ; prevents arbitrary environment variables reaching fpm worker processes ; clearing environment in workers before env vars specified in ; pool configuration added. ; setting "no" make environment variables available php code ; via getenv(), $_env , $_server. ; default value: yes ;clear_env = no   ; pass environment variables ld_library_path. $variables taken ; current environment. ; default value: clean env ;env[hostname] = $hostname ;env[path] = /usr/local/bin:/usr/bin:/bin ;env[tmp] = /tmp ;env[tmpdir] = /tmp ;env[temp] = /tmp 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -