Modifying Environment Variables

Environment variables are containers for modifiable values that you can place within custom-created files to change the behavior of Apache and PHP.

ALERT! Warning: Modifying variables can break Apache. cPanel takes no responsibility for custom changes, nor do we provide any warranty for what you do with this information. Proceed with caution.

EasyApache was built so that you can use a terminal session to change, add, or append environment variables. Once you have made changes to environment variables, you may use the /scripts/easyapache script or you may use the EasyApache (Apache Update) section in WHM.

Adding and Changing Variables

Adding or changing your variables in the following way may not be the most desirable method, as your needs may change over time.

To add or change variables:

  1. Create a file, with the name of the environment variable you wish to change, in the following directory:
    • /var/cpanel/easy/apache/rawenv/$environmentvariable
      • note Note: In this example, $environmentvariable is used in place of the variable’s name.
  2. In the file, enter the value of the variable.
  3. Save your changes.
  4. Run /scripts/easyapache or use the EasyApache interface in WHM to finish adding the environmental variable.

Appending Variables

Appending variables allows you to add an additional value, after the original value, without destroying the variable’s original value. To accomplish this, you will need to make a file that houses the additional value in a directory, outside of /var/cpanel/easy/apache/rawenv. This method, in many cases, is preferred to changing the variable directly.

To append an existing variable:

  1. Create a file in the following directory, using the following naming convention:
    • /var/cpanel/easy/apache/rawenv/.append_$environmentvariable
      • Note: In this example, $environmentvariable is meant to stand for the environment variable to which you wish to append data.
  2. In the file, enter the value which you wish to append to $environmentvariable.
  3. Run /scripts/easyapache or use the EasyApache interface in WHM to finish adding the environment variable.

Prepending Variables

Prepending a variable allows you to add an additional value before the original value, without destroying the variable’s original value.

To prepend an existing variable:

  1. Create a file in the following directory, using the following naming convention:
    • /var/cpanel/easy/apache/rawenv/.prepend_$environmentvariable
      • note Note: In this example $environmentvariable is meant to stand for the environmental variable you wish to prepend.
  2. In the file, enter the value which you wish to preprend to $environmentalvariable.
  3. Run /scripts/easyapache or use the EasyApache interface in WHM to finish adding the environment variable.

Skipping Your Custom Options at Build Time

If need be, you are able to build Apache without using the custom options you have specified. This can be useful for troubleshooting purposes.

  1. Type the following command before build time:
    • /scripts/easyapache --skip-rawenv
  2. Rebuild Apache using the /scripts/easyapache script.

If you would prefer to use the WHM interface to skip these variables:

  1. Click the Help link on the first EasyApache (Apache Update) screen.
  2. Check the Do not use raw env support checkbox.
  3. Click Submit.
  4. Return to the previous screen and build the profile.

If the build completes successfully without the custom environment variables, the variables need to be reconfigured or omitted.

Topic revision: r5 - 08 Jun 2009 - 16:13:28 - Main.JustinSchaefer
EasyApache3.ModifyingEnvironmentalVariables moved from Sandbox.ModifyingEnvironmentalVariables on 08 Jun 2009 - 14:46 by Main.JustinSchaefer - put it back
 

Copyright © cPanel 2000-2009.