putenv()


Overview

putenv() is a PHP function used to set the value of an environment variable. Versions: PHP 4, PHP 5, PHP 7, PHP 8.

Note:
The environment variable will only exist for the duration of the request. The environment will be reset to its previous state after the end of the request.

Parameters

putenv() can have a single parameter:

assignment: the name of the environment variable, and its value.

Return possibilities

setcookie() will return true if the operation has successfully completed, false if it has failed.

Example

php
putenv("VARIABLE_NAME"="VALUE");
See also

getenv()
Apache logo. Copyright may apply. How to set an environment variable on Apache using .htaccess
Get an environment variable | PHP Snippets