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
1
vote
1 answer

How to set PHP environment variables on Ubuntu

I'm sure this is easy if you know how, but I don't. I've got an ubuntu 10.04 server running PHP5 under apache, all defaults and stuff. The PHP needs some environment variables set. How do I do it? Do I put them in the apache site config? Do I set…
Leopd
  • 1,757
  • 4
  • 24
  • 30
1
vote
1 answer

FreeBSD aliased user identification and GNU screen

The situation is the following. I have FreeBSD user M, which is an alias for root, i.e., its UID equals to 0. I have a daemon started as M (as a shell for an autologin console, if it matters). The daemon should start screen non-interactively. And…
1
vote
1 answer

Is is possilbe to use environment variables in sudoers rules?

For example, there is a line defining the rule in sudoers file: %wheel ALL=(ALL) NOPASSWD: $HOME/bin/ls is it valid? If not, is there an equivalent way to achieve this goal? Thanks.
stid.smth
  • 111
  • 2
1
vote
1 answer

httpd conf environment variables - how do they work? (Centos 6)

I have the following config included in my httpd.conf... Include ${MODULE_DIR}/utilities/devconf/bo/vhost.conf where ${MODULE_DIR} is an environment variable that I am setting in my httpd init script (/etc/init.d/httpd) like…
Xoundboy
  • 603
  • 1
  • 10
  • 21
1
vote
2 answers

How do I set the ORACLE_HOME variable for the Local System account?

I've run into an issue with one of my systems where multiple Oracle versions are installed for the support of various applications, but I need to run a program as a Windows service using the Local System account. Currently, I am getting the…
anonymous
  • 267
  • 8
  • 17
1
vote
5 answers

Use of Export in Bash Script on CentOS

I am very new to Linux and am having problems with what should be a very simple Bash script in CentOS. #! /bin/bash # script to restore the cognos rds from snapshot export AWS_RDS_HOME=/opt/aws/apitools/rds export PATH=$PATH:$AWS_RDS_HOME/bin export…
1
vote
3 answers

how to set PATH in CentOS so that it is visible in PHP

I need my PATH environment variable to include /usr/local/bin when seen from PHP, so that I can execute binaries that are in /usr/local/bin with exec() in PHP code without writing their full path, e.g. exec("ffmpeg"); If from php I run echo…
matteo
  • 731
  • 2
  • 9
  • 21
1
vote
1 answer

Server-specific environment variables - /etc/profile or /etc/profile.d

I need to setup some system-wide environment variables for my Jetty server. But where to put them? There seem to be 2 choices /etc/profile or /etc/profile.d? Which are the differences between the two?
Trollhorn
  • 203
  • 3
  • 10
1
vote
1 answer

nginx does not use variables set in /etc/environment on system reboot, but does when restarted from shell

I have a Rails app running on nginx/passenger. It restarts happily in a shell using sudo /etc/init.d/nginx stop|start|restart. But Passenger throws an error when the system is rebooted: "Missing the Rails #{version} gem". But GEM_HOME and GEM_PATH…
Dave Nolan
  • 155
  • 2
  • 10
1
vote
1 answer

Using *.reg files for defining Environment variable on windows

I am preparing a set of instructions for automating an installation of some application on our team's computers and as part of that automation I need to add User Environment Variables and System Environment Variables. We are using both Windows XP…
RonK
  • 241
  • 1
  • 5
  • 13
1
vote
3 answers

Where are all the places Windows environment variables set?

When I run cmd.exe and type 'set' I have a %LIB% variable set. The value is pointing to a folder that doesn't exist, which causes warnings during Visual Studio compiles. Here's the thing... If I go to System Properties->Advanced->Environment…
1
vote
3 answers

Setting Environment Variable for nginx and Rails consumption

Apache's module mod_env offers a handy way of setting environment variables in configuration files, like: ServerName xyz.com DocumentRoot /var/www/rails_app/public PassengerAppRoot /var/www/rails_app SetEnv MY_VARIABLE…
kolrie
  • 235
  • 3
  • 12
1
vote
3 answers

Can't seem to get mod_rewrite to set an environment variable

This is just plain weird. I have put the following in an .htaccess file: RewriteRule ^a-file-on-the-server$ index.php [E=let_me_in:test] And in my PHP script, I have the following: print_r($_ENV); ...which prints out all the environment…
Nathan Osman
  • 2,725
  • 7
  • 32
  • 46
1
vote
2 answers

How to tell rails to use non-default ruby?

I need two different versions of ruby on a server. The packaged ruby for the packaged puppet to work, and a compiled ruby for a rails web app to work. So basically I want the default ruby to be the ruby from the package, and for rails to use the…
Hamish Downer
  • 9,420
  • 6
  • 38
  • 51
1
vote
5 answers

Sharing an Apache configuration between testing vs. production

I have a personal web site with a slightly nontrivial Apache configuration. I test changes on my personal machine before uploading them to the server. The path to the files on disk and the root URL of the site are of course different between the…