Please note that these documents apply to OpenShift Online v2 only (accounts created before August 1st, 2016).
If you are using one of the OpenShift 3 products, please refer to documents available at

Environment Variables

The php cartridges provide several additional environment variables to reference for ease of use:

Variable Name Description


The IP address the application listens on.


The port the application receives requests from.

The php cartridges also provides several environment variables to change the default PHP configuration:

Variable name Description


Application mode, default setting is production. When set to development, the Xdebug extension is enabled, more verbose error_reporting and the APC.stat setting are set. See development mode for more details.


Whether APC op-code cache PECL is enabled, true by default. Set value to false to turn this extension off.


The APC shared memory size. The default value is 64M on Small and Small.highcpu gears, 128M on Medium gears, and 256M on Large gears.


Whether Xdebug PECL is enabled, true by default. Set value to false to turn this extension off. This variable overrides behavior set by APPLICATION_ENV.


Whether <MODULE> PECL is enabled, true by default. Set value to false to turn the specified extension off. To list all enabled modules, run php -m command while ssh’d into the gear.


A case-insensitive string representing the maximum log file size that triggers a roll event. The default value is 10M. If a zero size is specified regardless of the unit, log rolling is effectively disabled.


An integer representing the maximum number of log files to retain. The default is 10. See logging environment variables for more details.

You must restart the php cartridge to pick-up the updated values.
The above 'defaults' are the default setting, not the default value for the variables. If no user-created environment variable is set, the default setting will be used.

Reading Environment Variables

The following example demonstrates how to read environment variables within your application code:

$env_var = getenv('OPENSHIFT_ENV_VAR');

Developers can safely store API keys and other credentials in the system environment by using rhc env set, allowing for clean and portable application sources. Learn more about using environment variables.