$_ENV

$_ENV — Variables d'environnement

Description

Un tableau associatif de variable passé au script courant, via la méthode d'environnement.
Cette variable est importée dans l'espace de nom global de PHP, depuis l'environnement dans lequel l'exécutable PHP fonctionne. De nombreuses valeurs sont fournies par le shell qui exécute PHP, et différents systèmes pouvant disposer de différents shell, même un début de liste serait ici impossible. Reportez-vous à la documentation de votre shell pour connaître une liste de variables pré-définies.
Les autres variables d'environnement incluent les variables CGI, placées ici, indépendamment du fait que PHP fonctionne en tant que CGI ou bien que module du serveur.
Exemple :
var_dump($_ENV);
Donne actuellement sur ce serveur :
array(55) {
  ["USER"]=>
  string(8) "belzoras"
  ["FCGI_ROLE"]=>
  string(9) "RESPONDER"
  ["APP_ENGINE"]=>
  string(3) "php"
  ["APP_ENGINE_VERSION"]=>
  string(3) "5.4"
  ["ENVIRONMENT"]=>
  string(10) "production"
  ["DOCUMENT_ROOT"]=>
  string(18) "/home/belzoras/www"
  ["UNIQUE_ID"]=>
  string(27) "aac2bY5CLlLXIGA2leRMjQAAAF8"
  ["GEOIP_COUNTRY_CODE"]=>
  string(2) "US"
  ["GEOIP_COUNTRY_NAME"]=>
  string(13) "United States"
  ["GEOIP_REGION"]=>
  string(2) "CA"
  ["GEOIP_CITY"]=>
  string(11) "Santa Paula"
  ["GEOIP_DMA_CODE"]=>
  string(3) "803"
  ["GEOIP_AREA_CODE"]=>
  string(3) "805"
  ["GEOIP_LATITUDE"]=>
  string(9) "34.355598"
  ["GEOIP_LONGITUDE"]=>
  string(11) "-119.070099"
  ["SCRIPT_URL"]=>
  string(94) "/Formation/_other_lessons/php-intro/courses/01-PHP/02-Les variables Superglobales/09-$_ENV.php"
  ["SCRIPT_URI"]=>
  string(114) "http://belzorash.com/Formation/_other_lessons/php-intro/courses/01-PHP/02-Les variables Superglobales/09-$_ENV.php"
  ["CFG_CLUSTER"]=>
  string(10) "cluster110"
  ["HTTP_HOST"]=>
  string(13) "belzorash.com"
  ["HTTP_X_PREDICTOR"]=>
  string(1) "1"
  ["HTTP_X_FORWARDED_FOR"]=>
  string(14) "216.73.216.119"
  ["HTTP_X_FORWARDED_PROTO"]=>
  string(4) "http"
  ["HTTP_X_OVHREQUEST_ID"]=>
  string(32) "623e575119555e06e305489524ecc4a1"
  ["HTTP_ACCEPT"]=>
  string(3) "*/*"
  ["HTTP_USER_AGENT"]=>
  string(103) "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)"
  ["HTTP_ACCEPT_ENCODING"]=>
  string(23) "gzip, br, zstd, deflate"
  ["HTTP_VIA"]=>
  string(45) "1.1 squid-proxy-5b5d847c96-fp7cq (squid/6.10)"
  ["HTTP_CACHE_CONTROL"]=>
  string(14) "max-age=259200"
  ["HTTP_X_FORWARDED_PORT"]=>
  string(2) "80"
  ["HTTP_X_REMOTE_PORT"]=>
  string(5) "22908"
  ["HTTP_X_REMOTE_IP"]=>
  string(14) "216.73.216.119"
  ["HTTP_X_REMOTE_PROTO"]=>
  string(4) "http"
  ["HTTP_FORWARDED"]=>
  string(50) "for=216.73.216.119; proto=http; host=belzorash.com"
  ["HTTP_X_IPLB_UNIQUE_ID"]=>
  string(49) "D849D877:597C_D5BA2113:0050_69A7366C_CCD30:1A37CB"
  ["HTTP_REMOTE_IP"]=>
  string(14) "216.73.216.119"
  ["SERVER_SIGNATURE"]=>
  string(0) ""
  ["SERVER_SOFTWARE"]=>
  string(6) "Apache"
  ["SERVER_NAME"]=>
  string(13) "belzorash.com"
  ["SERVER_ADDR"]=>
  string(11) "10.110.20.9"
  ["SERVER_PORT"]=>
  string(2) "80"
  ["REMOTE_ADDR"]=>
  string(14) "216.73.216.119"
  ["SERVER_ADMIN"]=>
  string(24) "postmaster@belzorash.com"
  ["SCRIPT_FILENAME"]=>
  string(112) "/home/belzoras/www/Formation/_other_lessons/php-intro/courses/01-PHP/02-Les variables Superglobales/09-$_ENV.php"
  ["REMOTE_PORT"]=>
  string(5) "61244"
  ["GATEWAY_INTERFACE"]=>
  string(7) "CGI/1.1"
  ["SERVER_PROTOCOL"]=>
  string(8) "HTTP/1.1"
  ["REQUEST_METHOD"]=>
  string(3) "GET"
  ["QUERY_STRING"]=>
  string(0) ""
  ["REQUEST_URI"]=>
  string(98) "/Formation/_other_lessons/php-intro/courses/01-PHP/02-Les%20variables%20Superglobales/09-$_ENV.php"
  ["SCRIPT_NAME"]=>
  string(94) "/Formation/_other_lessons/php-intro/courses/01-PHP/02-Les variables Superglobales/09-$_ENV.php"
  ["PHP_SELF"]=>
  string(94) "/Formation/_other_lessons/php-intro/courses/01-PHP/02-Les variables Superglobales/09-$_ENV.php"
  ["REQUEST_TIME_FLOAT"]=>
  float(1772566125.3869)
  ["REQUEST_TIME"]=>
  int(1772566125)
  ["argv"]=>
  array(0) {
  }
  ["argc"]=>
  int(0)
}