<HTML ><HEAD ><TITLE >putenv</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="PHP Options&Information" HREF="ref.info.html"><LINK REL="PREVIOUS" TITLE="phpversion" HREF="function.phpversion.html"><LINK REL="NEXT" TITLE="set_magic_quotes_runtime" HREF="function.set-magic-quotes-runtime.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.phpversion.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.set-magic-quotes-runtime.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.putenv" ></A >putenv</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN75277" ></A ><P > (PHP 3, PHP 4 )</P >putenv -- Sets the value of an environment variable</DIV ><DIV CLASS="refsect1" ><A NAME="AEN75280" ></A ><H2 >Description</H2 >void <B CLASS="methodname" >putenv</B > ( string setting)<BR ></BR ><P > Adds <TT CLASS="parameter" ><I >setting</I ></TT > 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. </P ><P > Setting certain environment variables may be a potential security breach. The <TT CLASS="literal" >safe_mode_allowed_env_vars</TT > directive contains a comma-delimited list of prefixes. In Safe Mode, the user may only alter environment variables whose names begin with the prefixes supplied by this directive. By default, users will only be able to set environment variables that begin with <TT CLASS="literal" >PHP_</TT > (e.g. <TT CLASS="literal" >PHP_FOO=BAR</TT >). Note: if this directive is empty, PHP will let the user modify ANY environment variable! </P ><P > The <TT CLASS="literal" >safe_mode_protected_env_vars</TT > directive contains a comma-delimited list of environment variables, that the end user won't be able to change using <B CLASS="function" >putenv()</B >. These variables will be protected even if <TT CLASS="literal" >safe_mode_allowed_env_vars</TT > is set to allow to change them. </P ><DIV CLASS="warning" ><P ></P ><TABLE CLASS="warning" BORDER="1" WIDTH="100%" ><TR ><TD ALIGN="CENTER" ><B >Warning</B ></TD ></TR ><TR ><TD ALIGN="LEFT" ><P > These directives have only effect when <A HREF="features.safe-mode.html" >safe-mode</A > itself is enabled! </P ></TD ></TR ></TABLE ></DIV ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN75302" ></A ><P ><B >Example 1. Setting an Environment Variable</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" >putenv ("UNIQID=$uniqid");</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ><P > See also <A HREF="function.getenv.html" ><B CLASS="function" >getenv()</B ></A >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.phpversion.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.set-magic-quotes-runtime.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >phpversion</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.info.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >set_magic_quotes_runtime</TD ></TR ></TABLE ></DIV ></BODY ></HTML >