1.2.426. Environment Variables

Environment variables are used to interact with the hosting system.

They often provides configuration parameter that are set by the host of the application to be used. That way, information is not hardcoded in the application, and may be changed at production.

<?php

//ENVIRONMENT set the production context
if (getenv('ENVIRONMENT') === 'Production') {
    $sshKey = getenv('HOST_KEY');
} elseif (getenv('ENVIRONMENT') === 'Developper') {
    $sshKey = 'NO KEY';
} else {
    header('No website here.');
    die();
}

?>

See also $_ENV.

1.2.426.1. Specs

Short name

Variables/UncommonEnvVar

Rulesets

All, Appinfo, CE

Exakat since

1.0.5

PHP Version

All

Severity

Time To Fix

Precision

Medium

Features

environment-variable

Available in

Entreprise Edition, Community Edition, Exakat Cloud