To set an environment variable in Linux for PHP and apache do the following- 1) Sudo vim /etc/sysconfig/httpd Add-> TEST_ENV=PROD 2) vim /etc/httpd/conf/httpd.conf Add-> SetEnv TOBY_ENV ${TOBY_ENV} 3) echo getenv('TOBY_ENV'); DONE!!!