php - Where to set environment variables for Ubuntu running on Vagrant? -


i'm running php app on heroku, , have no issues retrieving environment variables heroku:config command, need have separate variables locally.

i'm vagrant ssh-ing ubuntu, life of me can't figure out set variables. i've tried using ~/.bashrc, putting variables in provisioning script, can't $_env (or getenv()) function in php retrieve variable. when call functions told variables not set in environment.

any ideas how set environment variables in local environment php heroku app?

i guess should work ~/.bashrc file might depend bash use.

you can put env variables .profile example:

export java_home=/library/java/javavirtualmachines/jdk1.8.0_51.jdk/contents/home 

you need user runs apache (if apache or nginx or other web server use) make sure add variables user runs apache (if apache or nginx or other web server use), not vagrant user.

the difference heroku heroku user own process including web server variable define can accessed, standard ubuntu local (or vm-ized) web server owned root or web user.

if you're not sure can place variables inside /etc/environment , reference file /etc/apache2/envvars :

# load system environment variables. . /etc/environment 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -