File: language.variables.predefined.html

package info (click to toggle)
php3 3%3A3.0.18-0potato1.1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 17,736 kB
  • ctags: 11,198
  • sloc: ansic: 108,120; sh: 2,512; php: 2,024; yacc: 1,887; makefile: 1,038; perl: 537; pascal: 238; awk: 90; cpp: 28; sql: 11
file content (635 lines) | stat: -rw-r--r-- 13,004 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
<HTML
><HEAD
><TITLE
>Predefined variables</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.57"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="manual.html"><LINK
REL="UP"
TITLE="Variables"
HREF="language.variables.html"><LINK
REL="PREVIOUS"
TITLE="Variables"
HREF="language.variables.html"><LINK
REL="NEXT"
TITLE="Variable scope"
HREF="language.variables.scope.html"><META
NAME="HTTP_EQUIV"
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
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="language.variables.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 7. Variables</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="language.variables.scope.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="language.variables.predefined"
>Predefined variables</A
></H1
><P
>&#13;    PHP provides a large number of predefined variables to any script
    which it runs. Many of these variables, however, cannot be fully
    documented as they are dependent upon which server is running, the
    version and setup of the server, and other factors. Some of these
    variables will not be available when PHP is run on the
    command-line.
   </P
><P
>&#13;    Despite these factors, here is a list of predefined variables
    available under a stock installation of PHP 3 running as a module
    under a stock installation of <A
HREF="http://www.apache.org/"
TARGET="_top"
>Apache</A
> 1.3.6.
   </P
><P
>&#13;    For a list of all predefined variables (and lots of other useful
    information), please see (and use) <A
HREF="function.phpinfo.html"
><B
CLASS="function"
>phpinfo()</B
></A
>.
   </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
     This list is neither exhaustive nor intended to be. It is simply
     a guideline as to what sorts of predefined variables you can
     expect to have access to in your script.
    </P
></BLOCKQUOTE
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="language.variables.predefined.apache"
>Apache variables</A
></H2
><P
>&#13;     These variables are created by the <A
HREF="http://www.apache.org/"
TARGET="_top"
>Apache</A
> webserver. If you are running
     another webserver, there is no guarantee that it will provide the
     same variables; it may omit some, or provide others not listed
     here. That said, a large number of these variables are accounted
     for in the <A
HREF="http://hoohoo.ncsa.uiuc.edu/cgi/env.html"
TARGET="_top"
>CGI 1.1
     specification</A
>, so you should be able to expect those.
    </P
><P
>&#13;     Note that few, if any, of these will be available (or indeed have
     any meaning) if running PHP on the command line.
    </P
><P
>&#13;     <P
></P
><DIV
CLASS="variablelist"
><DL
><DT
>GATEWAY_INTERFACE</DT
><DD
><P
>&#13;         What revision of the CGI specification the server is using;
         i.e. 'CGI/1.1'.
        </P
></DD
><DT
>SERVER_NAME</DT
><DD
><P
>&#13;         The name of the server host under which the current script is
         executing. If the script is running on a virtual host, this
         will be the value defined for that virtual host.
        </P
></DD
><DT
>SERVER_SOFTWARE</DT
><DD
><P
>&#13;         Server identification string, given in the headers when
         responding to requests.
        </P
></DD
><DT
>SERVER_PROTOCOL</DT
><DD
><P
>&#13;         Name and revision of the information protocol via which the
         page was requested; i.e. 'HTTP/1.0';
        </P
></DD
><DT
>REQUEST_METHOD</DT
><DD
><P
>&#13;         Which request method was used to access the page; i.e. 'GET',
         'HEAD', 'POST', 'PUT'.
        </P
></DD
><DT
>QUERY_STRING</DT
><DD
><P
>&#13;         The query string, if any, via which the page was accessed.
        </P
></DD
><DT
>DOCUMENT_ROOT</DT
><DD
><P
>&#13;         The document root directory under which the current script is
         executing, as defined in the server's configuration file.
        </P
></DD
><DT
>HTTP_ACCEPT</DT
><DD
><P
>&#13;         Contents of the <TT
CLASS="literal"
>Accept:</TT
> header from the
         current request, if there is one.
        </P
></DD
><DT
>HTTP_ACCEPT_CHARSET</DT
><DD
><P
>&#13;         Contents of the <TT
CLASS="literal"
>Accept-Charset:</TT
> header
         from the current request, if there is one. Example:
         'iso-8859-1,*,utf-8'.
        </P
></DD
><DT
>HTTP_ENCODING</DT
><DD
><P
>&#13;         Contents of the <TT
CLASS="literal"
>Accept-Encoding:</TT
> header
         from the current request, if there is one. Example: 'gzip'.
        </P
></DD
><DT
>HTTP_ACCEPT_LANGUAGE</DT
><DD
><P
>&#13;         Contents of the <TT
CLASS="literal"
>Accept-Language:</TT
> header
         from the current request, if there is one. Example: 'en'.
        </P
></DD
><DT
>HTTP_CONNECTION</DT
><DD
><P
>&#13;         Contents of the <TT
CLASS="literal"
>Connection:</TT
> header from
         the current request, if there is one. Example: 'Keep-Alive'.
        </P
></DD
><DT
>HTTP_HOST</DT
><DD
><P
>&#13;         Contents of the <TT
CLASS="literal"
>Host:</TT
> header from the
         current request, if there is one.
        </P
></DD
><DT
>HTTP_REFERER</DT
><DD
><P
>&#13;         The address of the page (if any) which referred the browser
         to the current page. This is set by the user's browser; not
         all browsers will set this.
        </P
></DD
><DT
>HTTP_USER_AGENT</DT
><DD
><P
>&#13;         Contents of the <TT
CLASS="literal"
>User_Agent:</TT
> header from
         the current request, if there is one. This is a string
         denoting the browser software being used to view the current
         page; i.e. <TT
CLASS="computeroutput"
>Mozilla/4.5 [en] (X11; U; Linux
         2.2.9 i586)</TT
>. Among other things, you can use
         this value with <A
HREF="function.get-browser.html"
><B
CLASS="function"
>get_browser()</B
></A
> to tailor
         your page's functionality to the capabilities of the user's
         browser.
        </P
></DD
><DT
>REMOTE_ADDR</DT
><DD
><P
>&#13;         The IP address from which the user is viewing the current
         page.
        </P
></DD
><DT
>REMOTE_PORT</DT
><DD
><P
>&#13;         The port being used on the user's machine to communicate with
         the web server.
        </P
></DD
><DT
>SCRIPT_FILENAME</DT
><DD
><P
>&#13;         The absolute pathname of the currently executing script.
        </P
></DD
><DT
>SERVER_ADMIN</DT
><DD
><P
>&#13;         The value given to the SERVER_ADMIN (for Apache) directive in
         the web server configuration file. If the script is running
         on a virtual host, this will be the value defined for that
         virtual host.
        </P
></DD
><DT
>SERVER_PORT</DT
><DD
><P
>&#13;         The port on the server machine being used by the web server
         for communication. For default setups, this will be '80';
         using SSL, for instance, will change this to whatever your
         defined secure HTTP port is.
        </P
></DD
><DT
>SERVER_SIGNATURE</DT
><DD
><P
>&#13;         String containing the server version and virtual host name
         which are added to server-generated pages, if enabled.
        </P
></DD
><DT
>PATH_TRANSLATED</DT
><DD
><P
>&#13;         Filesystem- (not document root-) based path to the current
         script, after the server has done any virtual-to-real
         mapping.
        </P
></DD
><DT
>SCRIPT_NAME</DT
><DD
><P
>&#13;         Contains the current script's path. This is useful for pages
         which need to point to themselves.
        </P
></DD
><DT
>REQUEST_URI</DT
><DD
><P
>&#13;         The URI which was given in order to access this page; for
         instance, '/index.html'.
        </P
></DD
></DL
></DIV
>
    </P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="language.variables.predefined.environment"
>Environment variables</A
></H2
><P
>&#13;     These variables are imported into PHP's global namespace from the
     environment under which the PHP parser is running. Many are
     provided by the shell under which PHP is running and different
     systems are likely running different kinds of shells, a
     definitive list is impossible. Please see your shell's
     documentation for a list of defined environment variables.
    </P
><P
>&#13;     Other environment variables include the CGI variables, placed
     there regardless of whether PHP is running as a server module or
     CGI processor.
    </P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="language.variables.predefined.php"
>PHP variables</A
></H2
><P
>&#13;     These variables are created by PHP itself. The
     <TT
CLASS="varname"
>$HTTP_*_VARS</TT
> variables are available only if
     the <A
HREF="configuration.html#ini.track-vars"
>track_vars</A
>
     configuration is turned on.
    </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
      As of PHP 4.0.3, <A
HREF="configuration.html#ini.track-vars"
>track_vars</A
> is always turned on,
      regardless of the configuration file setting.
     </P
></BLOCKQUOTE
></DIV
><P
>&#13;     If the <A
HREF="configuration.html#ini.register-globals"
>register_globals</A
> directive
     is set, then these variables will also be made available in the
     global scope of the script; i.e., separate from the
     <TT
CLASS="varname"
>$HTTP_*_VARS</TT
> arrays. This feature should be
     used with care, and turned off if possible; while the
     <TT
CLASS="varname"
>$HTTP_*_VARS</TT
> variables are safe, the bare
     global equivalents can be overwritten by user input, with
     possibly malicious intent. If you cannot turn off <A
HREF="configuration.html#ini.register-globals"
>register_globals</A
>, you must
     take whatever steps are necessary to ensure that the data you are
     using is safe.
    </P
><P
>&#13;     <P
></P
><DIV
CLASS="variablelist"
><DL
><DT
>argv</DT
><DD
><P
>&#13;         Array of arguments passed to the script. When the script is
         run on the command line, this gives C-style access to the
         command line parameters. When called via the GET method, this
         will contain the query string.
        </P
></DD
><DT
>argc</DT
><DD
><P
>&#13;         Contains the number of command line parameters passed to the
         script (if run on the command line).
        </P
></DD
><DT
>PHP_SELF</DT
><DD
><P
>&#13;         The filename of the currently executing script, relative to
         the document root. If PHP is running as a command-line
         processor, this variable is not available.
        </P
></DD
><DT
>HTTP_COOKIE_VARS</DT
><DD
><P
>&#13;         An associative array of variables passed to the current
         script via HTTP cookies. 
        </P
></DD
><DT
>HTTP_GET_VARS</DT
><DD
><P
>&#13;         An associative array of variables passed to the current
         script via the HTTP GET method.
        </P
></DD
><DT
>HTTP_POST_VARS</DT
><DD
><P
>&#13;         An associative array of variables passed to the current
         script via the HTTP POST method.
        </P
></DD
><DT
>HTTP_POST_FILES</DT
><DD
><P
>&#13;         An associative array of variables containing information
         about files uploaded via the HTTP POST method. See <A
HREF="features.file-upload.html#features.file-upload.post-method"
>POST method
         uploads</A
> for information on the contents of
         <TT
CLASS="varname"
>$HTTP_POST_FILES</TT
>.
        </P
><P
>&#13;         <TT
CLASS="varname"
>$HTTP_POST_FILES</TT
> is available only in PHP
         4.0.0 and later.
        </P
></DD
><DT
>HTTP_ENV_VARS</DT
><DD
><P
>&#13;         An associative array of variables passed to the current
         script via the parent environment. 
        </P
></DD
><DT
>HTTP_SERVER_VARS</DT
><DD
><P
>&#13;         An associative array of variables passed to the current
         script from the HTTP server. These variables are analogous to
         the Apache variables described above.
        </P
></DD
></DL
></DIV
>
    </P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="language.variables.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="manual.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="language.variables.scope.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Variables</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="language.variables.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Variable scope</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>