I am creating PHP web application. I need to get environment variable in my web application. I am using Yosemite OSX.
I have executed following command:
launchctl setenv ENVIRONMENT development
I am able to get o/p for the following command:
launchctl getenv ENVIRONMENT
development
However, when I execute following in my PHP file
$env = getenv('ENVIRONMENT');
echo $env;
I am not able to see the result "development".
For setting environment variable I have also tried following: http://www.jochenhebbrecht.be/site/2015-04-14/mac/os-x-1010-yosemite-and-environment-variables
I have also executed following command:
launchctl load ~/Library/LaunchAgents/my.startup.plist
launchctl start ~/Library/LaunchAgents/my.startup.plist
When I execute launchctl load ~/Library/LaunchAgents/my.startup.plist
it gives me
Library/LaunchAgents/my.startup.plist: Operation already in progress
Also restart MAMP server, restart macbook. Did this for few times. But no success.
Can anyone please tell me what am I doing wrong?
If someone can tell me necessary steps to achieve final goal which is to use environment variable in my PHP application, I would be really grateful.
Thanks in advance.