3

Where can I find the envvars configuration file (if there are any) in CentOS?

I know in Ubuntu, Apache2, I can find it from /etc/apache2/envvars

I've tried the command,

export EXAMPLE=value command. Does it require server restart to get it affected?

Please advise, thanks in advance :)

Vaishak
  • 133
  • 1
  • 1
  • 7

3 Answers3

4

Global Environment variable file is :- /etc/profile

Local Environment Variable ( User Specific ) file is :- ~/.bash_profile

1

Rehdat Equiv to /etc/apache2/envvars

The Redhat and Centos equiv to /etc/apache2/envvars is /etc/sysconfig/httpd

The other answers are also correct if you are ok with the variables being truly global. Using /etc/sysconfig/httpd will keep the variables confined to httpd.

As Siddharth sharma pointed out, you can also set the environment variable in the apache config.

e.g.

SetEnv TMPDIR /var/www/.cgitmp
Aaron
  • 2,859
  • 2
  • 12
  • 30
  • The file `/etc/sysconfig/httpd` doesn't exist!! – Vaishak Jan 20 '16 at 05:21
  • How did you install apache? If you used `yum install httpd` then you most certainly would have that file. – Aaron Jan 20 '16 at 06:38
  • I'm not sure. I'm new to Linux, it was done by someone else and I'm figuring it out. Thanks :) – Vaishak Jan 20 '16 at 06:48
  • If someone removed the file by mistake, you can put it back. By default, it just contains `LANG=C` and a commented out `#OPTIONS=` – Aaron Jan 20 '16 at 06:50
  • As @Siddharth sharma said, _If you don't find your variables in these than it might be possible they exists at runtime. The kernel stores the list of environment variables and their values for each process_. I was able to find the environ files under different process. How can I find out whether the apache runs on httpd or litespeed? I could see both processes running. Confused. – Vaishak Jan 20 '16 at 07:43
0

Just run set and you will see all env variables of your session.
export acts immideately, you don't need any extra actions.

user1700494
  • 1,642
  • 2
  • 12
  • 21