language/predefined/variables/server.xml
a6d209f4ff71ccba3f1255902827f5df3e092ff9
...
...
@@ -1,7 +1,7 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
3

4
-
<phpdoc:varentry xmlns:phpdoc="http://php.net/ns/phpdoc" xml:id="reserved.variables.server" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
4
+
<refentry role="variable" xml:id="reserved.variables.server" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
5
5
<refnamediv>
6
6
<refname>$_SERVER</refname>
7
7
<refpurpose>Server and execution environment information</refpurpose>
...
...
@@ -10,27 +10,34 @@
10
10
<refsect1 role="description">
11
11
&reftitle.description;
12
12
<para>
13
-
<varname>$_SERVER</varname> is an array containing information
14
-
such as headers, paths, and script locations. The entries in this
15
-
array are created by the web server. There is no guarantee that
16
-
every web server will provide any of these; servers may omit some,
17
-
or provide others not listed here. That said, a large number of
18
-
these variables are accounted for in the <link
19
-
xlink:href="&url.rfc;3875">CGI/1.1 specification</link>, so you should
20
-
be able to expect those.
13
+
<varname>$_SERVER</varname> is an &array; containing information
14
+
such as headers, paths, and script locations.
15
+
The entries in this array are created by the web server, therefore there
16
+
is no guarantee that every web server will provide any of these;
17
+
servers may omit some, or provide others not listed here.
18
+
However, most of these variables are accounted for in the
19
+
<link xlink:href="&url.rfc;3875">CGI/1.1 specification</link>,
20
+
and are likely to be defined.
21
+
</para>
22
+
<note>
23
+
<simpara>
24
+
When running PHP on the <link linkend="features.commandline">command line</link>
25
+
most of these entries will not be available or have any meaning.
26
+
</simpara>
27
+
</note>
28
+
<para>
29
+
In addition to the elements listed below, PHP will create additional
30
+
elements with values from request headers. These entries will be named
31
+
<literal>HTTP_</literal> followed by the header name,
32
+
capitalized and with underscores instead of hyphens.
33
+
For example, the <literal>Accept-Language</literal> header would be
34
+
available as <code>$_SERVER['HTTP_ACCEPT_LANGUAGE']</code>.
21
35
</para>
22
36
</refsect1>
23
37

24
38
<refsect1 role="indices">
25
39
&reftitle.indices;
26
40

27
-
<simpara>
28
-
You may or may not find any of the following elements in
29
-
<varname>$_SERVER</varname>. Note that few, if any, of these will be
30
-
available (or indeed have any meaning) if running PHP on the
31
-
<link linkend="features.commandline">command line</link>.
32
-
</simpara>
33
-

34
41
<para>
35
42
<variablelist>
36
43
<varlistentry>
...
...
@@ -80,7 +87,7 @@
80
87
<listitem>
81
88
<simpara>
82
89
What revision of the CGI specification the server is using;
83
-
e.g. '<literal>CGI/1.1</literal>'.
90
+
e.g. <literal>'CGI/1.1'</literal>.
84
91
</simpara>
85
92
</listitem>
86
93
</varlistentry>
...
...
@@ -105,9 +112,9 @@
105
112
</simpara>
106
113
<note>
107
114
<simpara>
108
-
Under Apache 2, you must set <literal>UseCanonicalName = On</literal>
109
-
and <literal>ServerName</literal>. Otherwise, this value reflects the
110
-
hostname supplied by the client, which can be spoofed.
115
+
Under Apache 2, <literal>UseCanonicalName = On</literal> and
116
+
<literal>ServerName</literal> must be set. Otherwise, this value
117
+
reflects the hostname supplied by the client, which can be spoofed.
111
118
It is not safe to rely on this value in security-dependent contexts.
112
119
</simpara>
113
120
</note>
...
...
@@ -129,7 +136,7 @@
129
136
<listitem>
130
137
<simpara>
131
138
Name and revision of the information protocol via which the
132
-
page was requested; e.g. '<literal>HTTP/1.0</literal>';
139
+
page was requested; e.g. <literal>'HTTP/1.0'</literal>;
133
140
</simpara>
134
141
</listitem>
135
142
</varlistentry>
...
...
@@ -138,8 +145,8 @@
138
145
<term>'<varname>REQUEST_METHOD</varname>'</term>
139
146
<listitem>
140
147
<simpara>
141
-
Which request method was used to access the page; e.g. '<literal>GET</literal>',
142
-
'<literal>HEAD</literal>', '<literal>POST</literal>', '<literal>PUT</literal>'.
148
+
Which request method was used to access the page; e.g. <literal>'GET'</literal>,
149
+
<literal>'HEAD'</literal>, <literal>'POST'</literal>, <literal>'PUT'</literal>.
143
150
</simpara>
144
151
<note>
145
152
<para>
...
...
@@ -189,96 +196,6 @@
189
196
</varlistentry>
190
197

191
198
<varlistentry>
192
-
<term>'<varname>HTTP_ACCEPT</varname>'</term>
193
-
<listitem>
194
-
<simpara>
195
-
Contents of the <literal>Accept:</literal> header from the
196
-
current request, if there is one.
197
-
</simpara>
198
-
</listitem>
199
-
</varlistentry>
200
-

201
-
<varlistentry>
202
-
<term>'<varname>HTTP_ACCEPT_CHARSET</varname>'</term>
203
-
<listitem>
204
-
<simpara>
205
-
Contents of the <literal>Accept-Charset:</literal> header
206
-
from the current request, if there is one. Example:
207
-
'<literal>iso-8859-1,*,utf-8</literal>'.
208
-
</simpara>
209
-
</listitem>
210
-
</varlistentry>
211
-

212
-
<varlistentry>
213
-
<term>'<varname>HTTP_ACCEPT_ENCODING</varname>'</term>
214
-
<listitem>
215
-
<simpara>
216
-
Contents of the <literal>Accept-Encoding:</literal> header
217
-
from the current request, if there is one. Example: '<literal>gzip</literal>'.
218
-
</simpara>
219
-
</listitem>
220
-
</varlistentry>
221
-
222
-
<varlistentry>
223
-
<term>'<varname>HTTP_ACCEPT_LANGUAGE</varname>'</term>
224
-
<listitem>
225
-
<simpara>
226
-
Contents of the <literal>Accept-Language:</literal> header
227
-
from the current request, if there is one. Example: '<literal>en</literal>'.
228
-
</simpara>
229
-
</listitem>
230
-
</varlistentry>
231
-
232
-
<varlistentry>
233
-
<term>'<varname>HTTP_CONNECTION</varname>'</term>
234
-
<listitem>
235
-
<simpara>
236
-
Contents of the <literal>Connection:</literal> header from
237
-
the current request, if there is one. Example: '<literal>Keep-Alive</literal>'.
238
-
</simpara>
239
-
</listitem>
240
-
</varlistentry>
241
-

242
-
<varlistentry>
243
-
<term>'<varname>HTTP_HOST</varname>'</term>
244
-
<listitem>
245
-
<simpara>
246
-
Contents of the <literal>Host:</literal> header from the
247
-
current request, if there is one.
248
-
</simpara>
249
-
</listitem>
250
-
</varlistentry>
251
-

252
-
<varlistentry>
253
-
<term>'<varname>HTTP_REFERER</varname>'</term>
254
-
<listitem>
255
-
<simpara>
256
-
The address of the page (if any) which referred the user
257
-
agent to the current page. This is set by the user agent. Not
258
-
all user agents will set this, and some provide the ability
259
-
to modify <varname>HTTP_REFERER</varname> as a feature. In
260
-
short, it cannot really be trusted.
261
-
</simpara>
262
-
</listitem>
263
-
</varlistentry>
264
-

265
-
<varlistentry>
266
-
<term>'<varname>HTTP_USER_AGENT</varname>'</term>
267
-
<listitem>
268
-
<simpara>
269
-
Contents of the <literal>User-Agent:</literal> header from
270
-
the current request, if there is one. This is a string
271
-
denoting the user agent being which is accessing the page. A
272
-
typical example is: <computeroutput>Mozilla/4.5 [en] (X11; U;
273
-
Linux 2.2.9 i586)</computeroutput>. Among other things, you
274
-
can use this value with <function>get_browser</function> to
275
-
tailor your page's output to the capabilities of the user
276
-
agent.
277
-
</simpara>
278
-
</listitem>
279
-
</varlistentry>
280
-

281
-
<varlistentry>
282
199
<term>'<varname>HTTPS</varname>'</term>
283
200
<listitem>
284
201
<simpara>
...
...
@@ -308,9 +225,9 @@
308
225
</simpara>
309
226
<note>
310
227
<simpara>
311
-
Your web server must be configured to create this variable. For
312
-
example in Apache you'll need <literal>HostnameLookups On</literal>
313
-
inside &httpd.conf; for it to exist. See also
228
+
The web server must be configured to create this variable.
229
+
For example in Apache <literal>HostnameLookups On</literal> must be
230
+
set inside &httpd.conf; for it to exist. See also
314
231
<function>gethostbyaddr</function>.
315
232
</simpara>
316
233
</note>
...
...
@@ -380,16 +297,16 @@
380
297
<listitem>
381
298
<simpara>
382
299
The port on the server machine being used by the web server
383
-
for communication. For default setups, this will be '<literal>80</literal>';
300
+
for communication. For default setups, this will be <literal>'80'</literal>;
384
301
using SSL, for instance, will change this to whatever your
385
302
defined secure HTTP port is.
386
303
</simpara>
387
304
<note>
388
305
<simpara>
389
-
Under the Apache 2, you must set <literal>UseCanonicalName = On</literal>,
390
-
as well as <literal>UseCanonicalPhysicalPort = On</literal> in order to
391
-
get the physical (real) port, otherwise, this value can be spoofed and it
392
-
may or may not return the physical port value.
306
+
Under Apache 2, <literal>UseCanonicalName = On</literal>, as well
307
+
as <literal>UseCanonicalPhysicalPort = On</literal> must be set in
308
+
order to get the physical (real) port, otherwise, this value can be
309
+
spoofed, and it may or may not return the physical port value.
393
310
It is not safe to rely on this value in security-dependent contexts.
394
311
</simpara>
395
312
</note>
...
...
@@ -492,10 +409,9 @@
492
409
<listitem>
493
410
<simpara>
494
411
Contains any client-provided pathname information trailing the
495
-
actual script filename but preceding the query string, if
496
-
available. For instance, if the current script was accessed via
497
-
the
498
-
URL <filename>http://www.example.com/php/path_info.php/some/stuff?foo=bar</filename>,
412
+
actual script filename but preceding the query string, if available.
413
+
For instance, if the current script was accessed via the URI
414
+
<filename>http://www.example.com/php/path_info.php/some/stuff?foo=bar</filename>,
499
415
then <varname>$_SERVER['PATH_INFO']</varname> would
500
416
contain <literal>/some/stuff</literal>.
501
417
</simpara>
...
...
@@ -552,8 +468,7 @@ www.example.com
552
468
</para>
553
469
</refsect1>
554
470

555
-
</phpdoc:varentry>
556
-
471
+
</refentry>
557
472
<!-- Keep this comment at the end of the file
558
473
Local variables:
559
474
mode: sgml
560
475