<HTML ><HEAD ><TITLE >How to change configuration settings</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="Configuration" HREF="configuration.html"><LINK REL="PREVIOUS" TITLE="Configuration" HREF="configuration.html"><LINK REL="NEXT" TITLE="Configuration directives" HREF="configuration.directives.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="sect1" 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="configuration.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Chapter 4. Configuration</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="configuration.directives.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="configuration.changes" ></A >How to change configuration settings</H1 ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="configuration.changes.apache" ></A >Running <TT CLASS="literal" >PHP</TT > as Apache module</H2 ><P > When using PHP as an Apache module, you can also change the configuration settings using directives in Apache configuration files (e.g. <TT CLASS="filename" >httpd.conf</TT >) and <TT CLASS="filename" >.htaccess</TT > files (You will need "AllowOverride Options" or "AllowOverride All" privileges) </P ><P > With PHP 4.0, there are several Apache directives that allow you to change the PHP configuration from within the Apache configuration files. For a listing of which directives are <TT CLASS="constant" ><B >PHP_INI_ALL</B ></TT >, <TT CLASS="constant" ><B >PHP_INI_PERDIR</B ></TT >, or <TT CLASS="constant" ><B >PHP_INI_SYSTEM</B ></TT >, have a look at the table found within the <A HREF="function.ini-set.html" ><B CLASS="function" >ini_set()</B ></A > documentation. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Note: </B > With PHP 3.0, there are Apache directives that correspond to each configuration setting in the <TT CLASS="filename" >php3.ini</TT > name, except the name is prefixed by "php3_". </P ></BLOCKQUOTE ></DIV ><P > <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><SPAN CLASS="systemitem" >php_value</SPAN > <TT CLASS="parameter" ><I >name</I ></TT > <TT CLASS="parameter" ><I >value</I ></TT ></DT ><DD ><P > Sets the value of the specified directive. Can be used only with PHP_INI_ALL and PHP_INI_PERDIR type directives. To clear a previously set value use <TT CLASS="literal" >none</TT > as the value. <DIV CLASS="informalexample" ><A NAME="AEN2152" ></A ><P ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="ini" >php_value auto_prepend_file none</PRE ></TD ></TR ></TABLE ><P ></P ></DIV > </P ></DD ><DT ><SPAN CLASS="systemitem" >php_flag</SPAN > <TT CLASS="parameter" ><I >name</I ></TT > <TT CLASS="parameter" ><I >on|off</I ></TT ></DT ><DD ><P > Used to set a Boolean configuration directive. Can be used only with PHP_INI_ALL and PHP_INI_PERDIR type directives. </P ></DD ><DT ><SPAN CLASS="systemitem" >php_admin_value</SPAN > <TT CLASS="parameter" ><I >name</I ></TT > <TT CLASS="parameter" ><I >value</I ></TT ></DT ><DD ><P > Sets the value of the specified directive. This can NOT be used in <TT CLASS="filename" >.htaccess</TT > files. Any directive type set with <SPAN CLASS="systemitem" >php_admin_value</SPAN > can not be overridden by <TT CLASS="filename" >.htaccess</TT > or virtualhost directives. </P ></DD ><DT ><SPAN CLASS="systemitem" >php_admin_flag</SPAN > <TT CLASS="parameter" ><I >name</I ></TT > <TT CLASS="parameter" ><I >on|off</I ></TT ></DT ><DD ><P > Used to set a Boolean configuration directive. This can NOT be used in <TT CLASS="filename" >.htaccess</TT > files. Any directive type set with <SPAN CLASS="systemitem" >php_admin_flag</SPAN > can not be overridden by <TT CLASS="filename" >.htaccess</TT > or virtualhost directives. </P ></DD ></DL ></DIV > </P ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN2182" ></A ><P ><B >Example 4-2. Apache configuration example</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="ini" ><IfModule mod_php4.c> php_value include_path ".:/usr/local/lib/php" php_admin_flag safe_mode on </IfModule> <IfModule mod_php3.c> php3_include_path ".:/usr/local/lib/php" php3_safe_mode on </IfModule></PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > <DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Note: </B > PHP constants do not exist outside of PHP. For example, in <TT CLASS="filename" >httpd.conf</TT > you can not use PHP constants such as <TT CLASS="constant" ><B >E_ALL</B ></TT > or <TT CLASS="constant" ><B >E_NOTICE</B ></TT > to set the <A HREF="ref.errorfunc.html#ini.error-reporting" >error_reporting</A > directive as they will have no meaning and will evaluate to <SPAN CLASS="emphasis" ><I CLASS="emphasis" >0</I ></SPAN >. Use the associated bitmask values instead. These constants can be used in <TT CLASS="filename" >php.ini</TT > </P ></BLOCKQUOTE ></DIV > </P ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="configuration.changes.other" ></A >Other interfaces to <TT CLASS="literal" >PHP</TT ></H2 ><P > Regardless of the interface to <TT CLASS="literal" >PHP</TT > you can change certain values at runtime of your scripts through <A HREF="function.ini-set.html" ><B CLASS="function" >ini_set()</B ></A >. The following table provides an overview at which level a directive can be set/changed. </P ><P > <DIV CLASS="table" ><A NAME="AEN2200" ></A ><P ><B >Table 4-1. Definition of PHP_INI_* constants</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><THEAD ><TR ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Constant</TH ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Value</TH ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Meaning</TH ></TR ></THEAD ><TBODY ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >PHP_INI_USER</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >1</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Entry can be set in user scripts</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >PHP_INI_PERDIR</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >2</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" > Entry can be set in <TT CLASS="filename" >php.ini</TT >, <TT CLASS="filename" >.htaccess</TT > or <TT CLASS="filename" >httpd.conf</TT > </TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >PHP_INI_SYSTEM</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >4</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" > Entry can be set in <TT CLASS="filename" >php.ini</TT > or <TT CLASS="filename" >httpd.conf</TT > </TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >PHP_INI_ALL</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >7</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >Entry can be set anywhere</TD ></TR ></TBODY ></TABLE ></DIV > </P ><P > You can view the settings of the configuration values in the output of <A HREF="function.phpinfo.html" ><B CLASS="function" >phpinfo()</B ></A >. You can also access the values of individual configuration directives using <A HREF="function.ini-get.html" ><B CLASS="function" >ini_get()</B ></A > or <A HREF="function.get-cfg-var.html" ><B CLASS="function" >get_cfg_var()</B ></A >. </P ></DIV ></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="configuration.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="configuration.directives.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Configuration</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="configuration.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Configuration directives</TD ></TR ></TABLE ></DIV ></BODY ></HTML >