I'm struggling a bit with getting my environment variables through to my CodeIgniter project. I'm running an XAMMP localhost server for development. I've tried using the getenv($var);
which half worked, but it's not picking up the variables that I'm exporting in my terminal. I have a feeling that it's picking up the Apache environment rather than my actual local environment.
For instance, if I echo out my $PATH variable in terminal, I get a different output to echo getenv("PATH");
in my code.
Any help or a push in the right direction would be appreciated. Thanks in advance.
Use base_url() & site_url() like this. It will solve your problem whatever your domain. And remember dont change your config file's $config['base_url']
For resource link (images,js,css etc)
<?php echo base_url('assets/css/test.css');?>
// dont use base_url().'/assets/css/test.css' like this
and for others links
<?php echo site_url('controller/method');?>
It will work on any environment even in subdomain & (change domain name) not effect any code