Way 1 :
The easiest way, but it’s only available in this session, when you logout , or login for new session , the environment variable is not existed.
Run below command :
And check value of variable
Check this environment variable in
PHP CODE in old session
$environment = getenv('APPLICATION_ENV');
Way 2 :
- When you use this way, the environment variables will set for your user, not for all users in your OS. So if your have more than one , you should use this way to set environment variables. It’s will not conflict with another user.
- If you logout, and login with your user, it’s will be existed.
You can use
vim, nano, vi …etc
Add those lines and save
Then logout and login. And test.
PHP CODE i wrote in way 1
Way 3 :
This way will set environment variables for all users in your OS.
I choose this way, because i’m root =))
Then add this line
Then save & close the editor.
You don’t need to logout and login, it effect after you save .
Then this with
Note : bài này mình tự viết bằng tiếng anh nên có sai sót gì thì chỉnh giúp mình nhé. Thanks