---
title: "How can I set a custom environment variable to use with my application?"
date: "2025-05-08T07:32:24+00:00"
summary: "Set custom environment variables for Drupal apps with Apache config files. Learn how to create, apply, and use them in your code."
image:
type: "article"
url: "/acquia-cloud-platform/add-ons/cloud-ide/help/68761-how-can-i-set-custom-environment-variable-use-my-application"
id: "e0a6b3d9-0e6a-42ec-9726-aeca6c062a25"
---

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"

2.  Restart Apache:

    ide:~$ acli ide:service-restart apache

3.  Print the new environment variable in your application:

    print $_ENV["FOO"];

Drupal should return `bar`.