How can I set a custom environment variable to use with my application?
Date Published: May 8, 2025
If you set a custom environment variable through dotfiles or the terminal, the variable is not available in your Drupal application. Therefore, you must create a new .conf file under /home/ide/configs/apache2. The following is an example:
1. Create the variables.conf file and populate it with one or more SetEnv lines to declare your custom environment variables:
SetEnv FOO "bar"
Restart Apache:
ide:~$ acli ide:service-restart apache
Print the new environment variable in your application:
print $_ENV["FOO"];
Drupal should return bar.
How can I set a custom environment variable to use with my application? | Acquia Product Documentation
Cloud IDE
How can I set a custom environment variable to use with my application?