Questions tagged [environment-variables]

Environment variables are configuration options that can be set in a shell or other similar environments. All programs started from within the shell can read them and configure themselves.

Environment variables are key-value-pair configuration options like KEY=valueor FOO=bar. Environment variables allow you to configure a program before it gets executed and without the need to store these variables in proprietary configuration files.

They are present on all POSIX systems (Unix, Linux, BSD, Mac OS, DOS, Windows, ...). Environment variables can be set by any shell and read by nearly any programming language.

Some programming languages allow you to set Environment variables, but they only persist within the current process. You can't set them to be visible by the calling shell. So they are not useful for inter-process communication.

410 questions
7
votes
1 answer

Cron job running a Django Python command through a virtual environment not working

I have a crontab file supposedly executing a Django command after loading the project virtual environment: */1 * * * * source /home/virtualenvs/mydjangoproject-venv/bin/activate && python /home/www/production/mydjangoproject/manage.py…
bolino
  • 273
  • 3
  • 15
7
votes
3 answers

Apache Custom Header with an environment variable

I try to set a custom HTTP Header with an environment variable** with Apache server 2.4.6 and headers_module. I work inside a HTTP VHost on port 80. Everything work as expected with basic example like: Header set MyHeader "%D %t" I have read the…
S. Di Cioccio
  • 111
  • 1
  • 1
  • 5
7
votes
2 answers

Security implications of using relative paths in the PATH enivronmental variable?

We had an audit just flag us for having relative paths inside out $PATH env variable. I am uncertain if this is truly a security concern and would like to reach out to everyone to see if this is really a security concern or whether its just a best…
ehime
  • 597
  • 2
  • 7
  • 15
7
votes
2 answers

How to escape spaces in Apache SetEnvIf value

I am trying to use SetEnvIf (Apache2, via a .htaccess file) to store an environment variable where the value to be assigned to the variable needs to contain spaces. For example, trying to set environment variable "AUTH_KEY" to have value "a…
Alex B
  • 141
  • 1
  • 5
7
votes
3 answers

How do I set $TERM permanently in fish shell?

I use the fish shell. I'm trying to run vim inside tmux with the solarized theme, but the colors are broken unless I run: set -lx TERM screen-256color-bce; before running tmux attach. It's annoying having to run this every day, so I want to set the…
sjy
  • 207
  • 2
  • 8
7
votes
1 answer

Setting $PATH for weberver user

I tried to add $PATH for all users including the webserver user (i.e. www-data) with different methods such as editing /etc/profile, /etc/environment, etc. In all cases, it works in terminal, but not with shell commands within PHP. For example echo…
Googlebot
  • 1,047
  • 2
  • 15
  • 30
7
votes
2 answers

How do I prevent Apache/PHP from showing the environment variables section in phpinfo()?

I need to prevent users from accidentally exposing private data stored in the environment variables with phpinfo(). Is there a way to configure apache or php.ini to disallow sections rendered with phpinfo?
Tim Santeford
  • 288
  • 3
  • 7
7
votes
3 answers

Environment variable not being picked up by app when started with Upstart (Ubuntu)

How does one go about getting a new environment variable picked up system-wide without restarting the server? As its an Ubuntu 11.x server, I'm using Upstart to start/restart processes. I added a new environment variable to /etc/environment that…
Geuis
  • 637
  • 3
  • 8
  • 20
7
votes
3 answers

authorized_keys Environment Variables Not Setting Environment Variables

I have created the file ~/.ssh/environment in there I put: LEVEL=0 When I run a script over ssh to get the environment variable level it returns 0 like it should. In the authorized_keys file I have several keys and am trying to change the value on…
Buddy Lindsey
  • 269
  • 3
  • 9
6
votes
2 answers

How to configure environment variables in an IIS 7 application?

I need to set the environment variable COMPLUS_FORCEENC=1 in an ASP.NET application. This variable must be set at the time the worker process starts to have an effect. Therefore, I did this: Create a new user using the Computer Management…
boot4life
  • 279
  • 2
  • 5
  • 12
6
votes
3 answers

How do I view the RDS_ prefixed environment variables in AWS ElasticBeanstalk?

If you set up RDS with ElasticBeanstalk how can you go into the box (via eb ssh) and view the environment variables that are set when you apply RDS to your EB Instance? Amazon automatically sets up these environment variables.…
ThomasReggi
  • 621
  • 2
  • 10
  • 25
6
votes
2 answers

apache: Send request URI within HTTP header for static files

To fulfil the requirements of the PubSubHubbub 0.4 spec, I have to send a rel=self header for each file. I'm now trying to do that with Apache's mod_headers and environment variables: Header append Link ';…
cweiske
  • 791
  • 1
  • 13
  • 36
6
votes
1 answer

Environment variables using AWS CodeDeploy

I have a web application that utilizes environment variables for some of its configuration (DB credentials, API keys, etc). I'm currently using Elastic Beanstalk for deployment and can easily set these from within AWS, which is great because I don't…
Jeff
  • 205
  • 1
  • 3
  • 12
6
votes
1 answer

How can I use environment variables in haproxy.conf

My haproxy.cfg file has one backend servers using hostnames: backend servers server myapp ${PORTAL_PORT_3000_TCP_ADDR}:${PORTAL_PORT_3000_TCP_PORT} maxconn 32 myapp is running in other docker container linked to haproxy docker container. The…
Montells
  • 165
  • 2
  • 7
6
votes
3 answers

Windows: How do I add a program to the system's path environmental variable from the command line?

I'm looking to permanently add a directory to the %PATH% environmental available on a large number of Windows machines. Is there any way to do this from a command line (cmd) so I can script up a solution, rather than having to use GUI on dozens of…