php8.5
Home/ Manual/ info / functions/ putenv

putenv

PHP function Edit on GitHub ✎

(PHP 4, PHP 5, PHP 7, PHP 8)

Sets the value of an environment variable

Description

putenv(string $assignment): bool

Adds assignment to the server environment. The environment variable will only exist for the duration of the current request. At the end of the request the environment is restored to its original state.

Parameters

assignment

The setting, like "FOO=BAR"

Return Values

Success

Examples

Setting an environment variable

php
<?php
putenv("UNIQID=$uniqid");
?>

See Also

Source: reference/info/functions/putenv.xml · from the official PHP manual (php/doc-en)