install/ini.xml
9ab074d32484672f93e5d822f42fb94ae9088207
...
...
@@ -1,6 +1,6 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-
<chapter xml:id="configuration" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+
<chapter xml:id="configuration" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
4
4
<title>Runtime Configuration</title>
5
5

6
6
<sect1 xml:id="configuration.file">
...
...
@@ -19,19 +19,17 @@
19
19
<listitem>
20
20
<simpara>
21
21
SAPI module specific location (<literal>PHPIniDir</literal> directive
22
-
in Apache 2, <literal>-c</literal> command line option in CGI and CLI,
23
-
<literal>php_ini</literal> parameter in NSAPI)
22
+
in Apache 2, <literal>-c</literal> command line option in CGI and CLI)
24
23
</simpara>
25
24
</listitem>
26
25
<listitem>
27
26
<simpara>
28
-
The <varname>PHPRC</varname> environment variable. Before PHP 5.2.0,
29
-
this was checked after the registry key mentioned below.
27
+
The <varname>PHPRC</varname> environment variable.
30
28
</simpara>
31
29
</listitem>
32
30
<listitem>
33
31
<simpara>
34
-
As of PHP 5.2.0, the location of the <literal>php.ini</literal> file
32
+
The location of the <literal>php.ini</literal> file
35
33
can be set for different versions of PHP. The root of the registry keys depends on 32- or 64-bitness of the installed OS and PHP.
36
34
For 32-bit PHP on a 32-bit OS or a 64-bit PHP on a 64-bit OS use <literal>[(HKEY_LOCAL_MACHINE\SOFTWARE\PHP]</literal> for 32-bit version of PHP on a 64-bit OS use <literal>[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\PHP]</literal>] instead.
37
35
For same bitness installation the following registry keys
...
...
@@ -90,20 +88,23 @@
90
88
PHP to attempt to read &php.ini; from the root filesystem if it exists.
91
89
</para>
92
90
</note>
93
-
<para>
94
-
Using environment variables can be used in &php.ini; as shown below.
95
-
</para>
96
-
<para>
97
-
<example>
98
-
<title>&php.ini; Environment Variables</title>
99
-
<programlisting role="ini">
91
+
<simpara>
92
+
Environment variables can be referenced within configuration values
93
+
in &php.ini; as shown below. As of PHP 8.3.0, a fallback value can
94
+
be specified that will be used when the referenced variable is not
95
+
defined.
96
+
</simpara>
97
+
<example>
98
+
<title>&php.ini; Environment Variables</title>
99
+
<programlisting role="ini">
100
100
<![CDATA[
101
101
; PHP_MEMORY_LIMIT is taken from environment
102
102
memory_limit = ${PHP_MEMORY_LIMIT}
103
+
; If PHP_MAX_EXECUTION_TIME is not defined, it will fall back to 30
104
+
max_execution_time = ${PHP_MAX_EXECUTION_TIME:-30}
103
105
]]>
104
-
</programlisting>
105
-
</example>
106
-
</para>
106
+
</programlisting>
107
+
</example>
107
108
<para>
108
109
The &php.ini; directives handled by extensions are documented
109
110
on the respective pages of the extensions themselves. A <link linkend="ini">list of
...
...
@@ -138,7 +139,7 @@ include_path = ".;c:\php\lib"
138
139
</example>
139
140
</para>
140
141
<para>
141
-
Since PHP 5.1.0, it is possible to refer to existing .ini variables from
142
+
It is possible to refer to existing .ini variables from
142
143
within .ini files. Example: <literal>open_basedir = ${open_basedir}
143
144
":/new/dir"</literal>.
144
145
</para>
...
...
@@ -148,8 +149,8 @@ include_path = ".;c:\php\lib"
148
149
<para>
149
150
It is possible to configure PHP to scan for .ini files in a directory
150
151
after reading &php.ini;. This can be done at compile time by setting the
151
-
<option role="configure">--with-config-file-scan-dir</option> option. In
152
-
PHP 5.2.0 and later, the scan directory can then be overridden at run time
152
+
<option role="configure">--with-config-file-scan-dir</option> option.
153
+
The scan directory can then be overridden at run time
153
154
by setting the <varname>PHP_INI_SCAN_DIR</varname> environment variable.
154
155
</para>
155
156

...
...
@@ -195,57 +196,13 @@ $ PHP_INI_SCAN_DIR=/usr/local/etc/php.d: php
195
196
</screen>
196
197
</informalexample>
197
198
</sect2>
198
-
<sect2 xml:id="configuration.file.changelog">
199
-
&reftitle.changelog;
200
-

201
-
<para>
202
-
<informaltable>
203
-
<tgroup cols="2">
204
-
<thead>
205
-
<row>
206
-
<entry>&Version;</entry>
207
-
<entry>&Description;</entry>
208
-
</row>
209
-
</thead>
210
-
<tbody>
211
-
<row>
212
-
<entry>7.0.0</entry>
213
-
<entry>
214
-
Hash marks (<literal>#</literal>) are no longer recognized as comments.
215
-
</entry>
216
-
</row>
217
-
<row>
218
-
<entry>5.3.0</entry>
219
-
<entry>
220
-
Hash marks (<literal>#</literal>) should no longer be used as comments
221
-
and will throw a deprecation warning if used.
222
-
</entry>
223
-
</row>
224
-
<row>
225
-
<entry>5.2.0</entry>
226
-
<entry>
227
-
The <varname>PHP_INI_SCAN_DIR</varname> environment variable can be
228
-
set to override the scan directory set via the configure script.
229
-
</entry>
230
-
</row>
231
-
<row>
232
-
<entry>5.1.0</entry>
233
-
<entry>
234
-
It is possible to refer to existing .ini variables from within .ini files.
235
-
</entry>
236
-
</row>
237
-
</tbody>
238
-
</tgroup>
239
-
</informaltable>
240
-
</para>
241
-
</sect2>
242
199
</sect1>
243
200

244
201
<sect1 xml:id="configuration.file.per-user">
245
202
<title>.user.ini files</title>
246
203

247
204
<simpara>
248
-
Since PHP 5.3.0, PHP includes support for configuration INI files on a
205
+
PHP includes support for configuration INI files on a
249
206
per-directory basis. These files are processed <emphasis>only</emphasis> by
250
207
the CGI/FastCGI SAPI. This functionality obsoletes the PECL htscanner
251
208
extension. If you are running PHP as Apache module, use &htaccess; files for the same
...
...
@@ -261,8 +218,8 @@ $ PHP_INI_SCAN_DIR=/usr/local/etc/php.d: php
261
218
</simpara>
262
219
<simpara>
263
220
Only INI settings with the
264
-
modes <constant>PHP_INI_PERDIR</constant> and
265
-
<constant>PHP_INI_USER</constant> will be recognized in .user.ini-style INI
221
+
modes <constant>INI_PERDIR</constant> and
222
+
<constant>INI_USER</constant> will be recognized in .user.ini-style INI
266
223
files.
267
224
</simpara>
268
225

...
...
@@ -299,50 +256,71 @@ $ PHP_INI_SCAN_DIR=/usr/local/etc/php.d: php
299
256
<para>
300
257
For example, the
301
258
<link linkend="ini.output-buffering">output_buffering</link> setting
302
-
is <literal>PHP_INI_PERDIR</literal> therefore it may not be set using
259
+
is <constant>INI_PERDIR</constant> therefore it may not be set using
303
260
<function>ini_set</function>. However, the
304
261
<link linkend="ini.display-errors">display_errors</link> directive is
305
-
<literal>PHP_INI_ALL</literal> therefore it may be set anywhere,
262
+
<constant>INI_ALL</constant> therefore it may be set anywhere,
306
263
including with <function>ini_set</function>.
307
264
</para>
308
265

309
266
<para>
310
-
<table>
311
-
<title>Definition of PHP_INI_* modes</title>
312
-
<tgroup cols="2">
313
-
<thead>
314
-
<row>
315
-
<entry>Mode</entry>
316
-
<entry>Meaning</entry>
317
-
</row>
318
-
</thead>
319
-
<tbody>
320
-
<row>
321
-
<entry><literal>PHP_INI_USER</literal></entry>
322
-
<entry>
323
-
Entry can be set in user scripts (like with <function>ini_set</function>)
324
-
or in the <link linkend="configuration.changes.windows">Windows registry</link>.
325
-
Since PHP 5.3, entry can be set in &user-ini;
326
-
</entry>
327
-
</row>
328
-
<row>
329
-
<entry><literal>PHP_INI_PERDIR</literal></entry>
330
-
<entry>
331
-
Entry can be set in &php.ini;, &htaccess;, &httpd.conf; or &user-ini;
332
-
(since PHP 5.3)
333
-
</entry>
334
-
</row>
335
-
<row>
336
-
<entry><literal>PHP_INI_SYSTEM</literal></entry>
337
-
<entry>Entry can be set in &php.ini; or &httpd.conf;</entry>
338
-
</row>
339
-
<row>
340
-
<entry><literal>PHP_INI_ALL</literal></entry>
341
-
<entry>Entry can be set anywhere</entry>
342
-
</row>
343
-
</tbody>
344
-
</tgroup>
345
-
</table>
267
+
<variablelist>
268
+
<!--
269
+
Replace everything inside the <variablelist> element with an <xi:include>
270
+
once libxml2 gets XInclude 1.1 attribute copying support.
271
+
The below <xi:include> will include the appropriate elements
272
+
but needs all top-level xml:id's removed (see XInclude 1.1 set-xml-id).
273
+

274
+
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('constant.ini-mode')/*)"><xi:fallback/></xi:include>
275
+
-->
276
+
<title>INI mode constants</title>
277
+
<varlistentry>
278
+
<term>
279
+
<constant>INI_USER</constant>
280
+
(<type>int</type>)
281
+
</term>
282
+
<listitem>
283
+
<simpara>
284
+
Entry can be set in user scripts (like with <function xmlns="http://docbook.org/ns/docbook">ini_set</function>)
285
+
or in the <link xmlns="http://docbook.org/ns/docbook" linkend="configuration.changes.windows">Windows registry</link>.
286
+
Entry can be set in &user-ini;
287
+
</simpara>
288
+
</listitem>
289
+
</varlistentry>
290
+
<varlistentry>
291
+
<term>
292
+
<constant>INI_PERDIR</constant>
293
+
(<type>int</type>)
294
+
</term>
295
+
<listitem>
296
+
<simpara>
297
+
Entry can be set in &php.ini;, &htaccess;, &httpd.conf; or &user-ini;
298
+
</simpara>
299
+
</listitem>
300
+
</varlistentry>
301
+
<varlistentry>
302
+
<term>
303
+
<constant>INI_SYSTEM</constant>
304
+
(<type>int</type>)
305
+
</term>
306
+
<listitem>
307
+
<simpara>
308
+
Entry can be set in &php.ini; or &httpd.conf;
309
+
</simpara>
310
+
</listitem>
311
+
</varlistentry>
312
+
<varlistentry>
313
+
<term>
314
+
<constant>INI_ALL</constant>
315
+
(<type>int</type>)
316
+
</term>
317
+
<listitem>
318
+
<simpara>
319
+
Entry can be set anywhere
320
+
</simpara>
321
+
</listitem>
322
+
</varlistentry>
323
+
</variablelist>
346
324
</para>
347
325
</sect1>
348
326

...
...
@@ -362,8 +340,8 @@ $ PHP_INI_SCAN_DIR=/usr/local/etc/php.d: php
362
340
There are several Apache directives that allow you
363
341
to change the PHP configuration from within the Apache configuration
364
342
files. For a listing of which directives are
365
-
<constant>PHP_INI_ALL</constant>, <constant>PHP_INI_PERDIR</constant>,
366
-
or <constant>PHP_INI_SYSTEM</constant>, have a look at the
343
+
<constant>INI_ALL</constant>, <constant>INI_PERDIR</constant>,
344
+
or <constant>INI_SYSTEM</constant>, have a look at the
367
345
<link linkend="ini.list">List of php.ini directives</link> appendix.
368
346
</para>
369
347

...
...
@@ -378,7 +356,7 @@ $ PHP_INI_SCAN_DIR=/usr/local/etc/php.d: php
378
356
<listitem>
379
357
<para>
380
358
Sets the value of the specified directive.
381
-
Can be used only with <constant>PHP_INI_ALL</constant> and <constant>PHP_INI_PERDIR</constant> type directives.
359
+
Can be used only with <constant>INI_ALL</constant> and <constant>INI_PERDIR</constant> type directives.
382
360
To clear a previously set value use <literal>none</literal> as the value.
383
361
</para>
384
362
<note>
...
...
@@ -398,8 +376,8 @@ $ PHP_INI_SCAN_DIR=/usr/local/etc/php.d: php
398
376
<listitem>
399
377
<para>
400
378
Used to set a boolean configuration directive.
401
-
Can be used only with <constant>PHP_INI_ALL</constant> and
402
-
<constant>PHP_INI_PERDIR</constant> type directives.
379
+
Can be used only with <constant>INI_ALL</constant> and
380
+
<constant>INI_PERDIR</constant> type directives.
403
381
</para>
404
382
</listitem>
405
383
</varlistentry>
...
...
@@ -482,8 +460,8 @@ $ PHP_INI_SCAN_DIR=/usr/local/etc/php.d: php
482
460
should have the name of the PHP configuration directive and the
483
461
string value. PHP constants in the values are not parsed.
484
462
However, only configuration values changeable in
485
-
<constant>PHP_INI_USER</constant> can be set
486
-
this way, <constant>PHP_INI_PERDIR</constant> values can not,
463
+
<constant>INI_USER</constant> can be set
464
+
this way, <constant>INI_PERDIR</constant> values can not,
487
465
because these configuration values are re-read for each request.
488
466
</simpara>
489
467
</sect2>
490
468