I have a crontab running every hour. The user running it has environment variabless in the .bash_profile
that work when the user runs the job from the terminal,
For me I had to set the environment variable for a php application. I resloved it by adding the following code to my crontab.
$ sudo crontab -e
crontab:
ENVIRONMENT_VAR=production
* * * * * /home/deploy/my_app/cron/cron.doSomethingWonderful.php
and inside doSomethingWonderful.php I could get the environment value with:
"production"
I hope this helps!