forked from apple-oss-distributions/apache_mod_php
-
Notifications
You must be signed in to change notification settings - Fork 1
/
phar.1
483 lines (483 loc) · 13.1 KB
/
phar.1
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
.\" $Id: phar.1,v 1.13 2010/01/26 00:59:49 cjalbert Exp $
.\"
.\" Copyright (c) 2010 Apple Inc. and The PHP Group, all rights reserved.
.\"/usr/share/misc/mdoc.template
.mso www.tmac
.Dd November 12, 2010
.Dt phar 1
.Sh NAME
.Nm phar ,
.Nm phar.phar
.Nd PHP archive command
.Sh SYNOPSIS
.Nm
.Ar command
.Fl f Ar file
.Op command-options
.Sh DESCRIPTION
PHP's phar extension provides a way to put entire PHP applications into a
single file called a
.Qq phar
(PHP Archive) for easy distribution and installation. In addition to providing
this service, the phar extension also provides a file-format abstraction method
for creating and manipulating tar and zip files through the PharData class.
.Pp
What is phar? Phar archives are best characterized as a convenient way to group
several files into a single file. As such, a phar archive provides a way to
distribute a complete PHP application in a single file and run it from that
file without the need to extract it to disk. Additionally, phar archives can be
executed by PHP as easily as any other file, both on the commandline and from a
web server. Phar is kind of like a thumb drive for PHP applications.
.Pp
Run
.Ql Cm phar help
to access the built-in tool documentation.
.Pp
Run
.Ql Cm phar help Ar command
to retrieve help for a specific command.
.Pp
Run
.Ql Cm phar help-list
to list all available commands.
.Pp
Run
.Ql Cm phar version
to get information about the PHAR environment and the tool version.
.Sh COMMAND SUMMARY
The following file operation commands are available.
.Bl -tag -width ".Cm compress" -offset indent -compact
.It Cm add
Add entries to a PHAR package
.It Cm compress
Compress or uncompress all files or a selected entry
.It Cm delete
Delete entry from a PHAR archive
.It Cm extract
Extract a PHAR package to a directory
.It Cm info
Get information about a PHAR package
.It Cm list
List contents of a PHAR archive
.It Cm meta-del
Delete meta information of a PHAR entry or a PHAR package
.It Cm meta-get
Get meta information of a PHAR entry or a PHAR package in serialized form
.It Cm meta-set
Set meta information of a PHAR entry or a PHAR package using serialized input
.It Cm pack
Pack files into a PHAR archive
.It Cm sign
Set signature hash algorithm
.It Cm stub-get
Get the stub of a PHAR file
.It Cm stub-set
Set the stub of a PHAR file
.It Cm tree
Get a directory tree for a PHAR archive
.El
.Sh COMMON OPTIONS
Every file operation command requires at least one argument:
.Bl -tag -width ".Fl h Ar method" -offset indent -compact
.It Fl f Ar file
Specifies the phar file to work on
.El
.Pp
Some commands also accept or require the following arguments as noted below in
their extended descriptions:
.Bl -tag -width ".Fl h Ar method" -offset indent -compact
.It Fl c Ar algo
Selects the compression algorithm from the following:
.Bl -tag -width ".Ar openssl" -offset 3m -compact
.It Ar 0
No compression
.It Ar none
No compression
.It Ar auto
Automatically select compression algorithm
.It Ar gz
GZip compression
.It Ar gzip
GZip compression
.It Ar bz2
BZip2 compression
.It Ar bzip2
BZip2 compression
.El
.It Fl h Ar method
Selects the hash algorithm from the following:
.Bl -tag -width ".Ar openssl" -offset 3m -compact
.It Ar md5
MD5
.It Ar sha1
SHA1
.It Ar sha256
SHA256
.It Ar sha512
SHA512
.It Ar openssl
OpenSSL
.El
.It Fl k Ar index
Subscription index (a string
.Qq key
associated with a dictionary entry) to operate upon. Valid values currently
include:
.Bl -tag -width ".Ar openssl" -offset 3m -compact
.It Ar Alias
.It Ar Hash-type
.It Ar Hash
.It Ar Entries
.It Ar Uncompressed-files
.It Ar Compressed-files
.It Ar Compressed-gz
.It Ar Compressed-bz2
.It Ar Uncompressed-size
.It Ar Compressed-size
.It Ar Compression-ratio
.It Ar Metadata-global
.It Ar Metadata-files
.It Ar Stub-size
.El
.El
.Sh COMMAND DETAILS
The following file operation commands are available.
.Bl -tag -width 6n
.\" -- add --
.It Cm add Fl f Ar file Oo command-options Oc Ar ...
.Bl -item
.It
Additional required arguments:
.Bl -tag -width ".Fl h Ar method" -offset 3m -compact
.It Ar ...
Any number of input files and directories. If
.Fl i
is in use then ONLY files and matching the given regular expression are being
packed. If
.Fl x
is given then files matching that regular expression are NOT being packed.
.El
.It
Optional arguments:
.Bl -tag -width ".Fl h Ar method" -offset 3m -compact
.It Fl a Ar alias
Provide an alias name for the phar file
.It Fl c Ar algo
Compression algorithm (see COMMON OPTIONS above)
.It Fl i Ar regex
Specifies a regular expression for input files
.It Fl l Ar level
Number of preceeding subdirectories to strip from file entries
.It Fl x Ar regex
Regular expression for input files to exclude
.El
.El
.\" -- compress --
.It Cm compress Fl f Ar file Fl c Ar algo Op Fl e Ar entry
.Bl -item
.It
Additional required arguments:
.Bl -tag -width ".Fl h Ar method" -offset 3m -compact
.It Fl c Ar algo
Compression algorithm (see COMMON OPTIONS above)
.El
.It
Optional arguments:
.Bl -tag -width ".Fl h Ar method" -offset 3m -compact
.It Fl e Ar entry
Name of entry to work on (must include PHAR internal directory name if any)
.El
.El
.\" -- delete --
.It Cm delete Fl f Ar file Fl e Ar entry
.Bl -item
.It
Additional required arguments:
.Bl -tag -width ".Fl h Ar method" -offset 3m -compact
.It Fl e Ar entry
Name of entry to work on (must include PHAR internal directory name if any)
.El
.El
.\" -- extract --
.It Cm extract Fl f Ar file Oo Fl i Ar regex Oc Oo Fl x Ar regex Oc Oo Ar ... Oc
.Bl -item
.It
Optional arguments:
.Bl -tag -width ".Fl h Ar method" -offset 3m -compact
.It Fl i Ar regex
Specifies a regular expression for input files
.It Fl x Ar regex
Regular expression for input files to exclude
.It Ar ...
Directory to extract to (defaults to '.')
.El
.El
.\" -- info --
.It Cm info Fl f Ar file Op Fl k Ar index
.Bl -item
.It
Optional arguments:
.Bl -tag -width ".Fl h Ar method" -offset 3m -compact
.It Fl k Ar index
Return the single value associated with the given subscription index
.El
.El
.\" -- list --
.It Cm list Fl f Ar file Oo Fl i Ar regex Oc Oo Fl x Ar regex Oc
.Bl -item
.It
Optional arguments:
.Bl -tag -width ".Fl h Ar method" -offset 3m -compact
.It Fl i Ar regex
Specifies a regular expression for input files
.It Fl x Ar regex
Regular expression for input files to exclude
.El
.El
.\" -- meta-del --
.It Cm meta-del Fl f Ar file Oo Fl e Ar entry Oc Oo Fl k Ar index Oc
.Bl -item
.It
Optional arguments:
.Bl -tag -width ".Fl h Ar method" -offset 3m -compact
.It Fl e Ar entry
Name of entry to work on (must include PHAR internal directory name if any)
.It Fl k Ar index
Delete the given subscription index in the array of metadata
.El
.It
If something was deleted the return value is 0 otherwise it is 1.
.El
.\" -- meta-get --
.It Cm meta-get Fl f Ar file Oo Fl e Ar entry Oc Oo Fl k Ar index Oc
.Bl -item
.It
If no output file is specified for metadata then print to stdout.
.It
Optional arguments:
.Bl -tag -width ".Fl h Ar method" -offset 3m -compact
.It Fl e Ar entry
Name of entry to work on (must include PHAR internal directory name if any)
.It Fl k Ar index
Return the given subscription index in the array of metadata using echo
rather than serialize. If that index does not exist or no metadata is present,
then the return value is 1.
.El
.El
.\" -- meta-set --
.It Cm meta-set Fl f Ar file Fl m Ar meta Oo Fl e Ar entry Oc Oo Fl k Ar index Oc
.Bl -item
.It
If no input file is specified for meta data then stdin is used.
.It
Additional required arguments:
.Bl -tag -width ".Fl h Ar method" -offset 3m -compact
.It Fl m Ar meta
Meta data to store with entry (serialized php data)
.El
.It
Optional arguments:
.Bl -tag -width ".Fl h Ar method" -offset 3m -compact
.It Fl e Ar entry
Name of entry to work on (must include PHAR internal directory name if any)
.It Fl k Ar index
Take the input directly (instead of serialized) and set the value for the
given index in the array of metadata. If the metadata is not present or empty
a new array will be created.
If the metadata is present and a flat value, then the return value is 1.
.El
.El
.\" -- pack --
.It Cm pack Fl f Ar file Oo command-options Oc Ar ...
.Bl -item
.It
When using
.Fl s Ar stub ,
the stub file is excluded from the list of input files/dirs. To create an
archive that contains PEAR's class
.Vt PHP_Archive
then point
.Fl p
argument to
.Pa PHP/Archive.php .
.It
Additional required arguments:
.Bl -tag -width ".Fl h Ar method" -offset 3m -compact
.It Ar ...
Any number of input files and directories. If
.Fl i
is in use then ONLY files and matching the given regular expression are being
packed. If
.Fl x
is given then files matching that regular expression are NOT being packed.
.El
.It
Optional arguments:
.Bl -tag -width ".Fl h Ar method" -offset 3m -compact
.It Fl a Ar alias
Provide an alias name for the phar file.
.It Fl b Ar bang
Hash-bang line to start the archive (e.g.
.Pa #!/usr/bin/php ) .
The hash mark itself
.Qq #!
and the newline character are optional.
.It Fl c Ar algo
Compression algorithm (see COMMON OPTIONS above)
.It Fl h Ar method
Selects the hash algorithm (see COMMON OPTIONS above)
.It Fl i Ar regex
Specifies a regular expression for input files
.It Fl l Ar level
Number of preceeding subdirectories to strip from file entries
.It Fl p Ar loader
Location of
.Vt PHP_Archive
class file (
.Cm pear list-files PHP_Archive
). You can use '0' or '1' to locate it automatically using the mentioned
.Xr pear 1
command. Passing '0' causes the command to not error out when the class file
cannot be located. This switch also adds some code around the stub so that
class
.Vt PHP_Archive
gets registered as the phar:// stream wrapper if necessary. Finally, this
switch adds the file
.Pa phar.inc
from this package and loads it to ensure class
.Vt Phar
is present.
.It Fl s Ar stub
Select the stub file
.It Fl x Ar regex
Regular expression for input files to exclude
.It Fl y Ar key
Private key for OpenSSL signing
.El
.El
.\" -- sign --
.It Cm sign Fl f Ar file Fl h Ar method Op Fl y Ar key
.Bl -item
.It
Additional required arguments:
.Bl -tag -width ".Fl h Ar method" -offset 3m -compact
.It Fl h Ar method
Selects the hash algorithm (see COMMON OPTIONS above)
.El
.It
Optional arguments:
.Bl -tag -width ".Fl h Ar method" -offset 3m -compact
.It Fl y Ar key
Private key for OpenSSL signing
.El
.El
.\" -- stub-get --
.It Cm stub-get Fl f Ar file Op Fl s Ar stub
.Bl -item
.It
If no output file is specified then print the stub to stdout.
.It
Optional arguments:
.Bl -tag -width ".Fl h Ar method" -offset 3m -compact
.It Fl s Ar stub
Select the stub file
.El
.El
.\" -- stub-set --
.It Cm stub-set Fl f Ar file Oo Fl b Ar bang Oc Oo Fl p Ar loader Oc Oo Fl s Ar stub Oc
.Bl -item
.It
If no input file is specified then stdin is used as the source of the stub.
.It
Optional arguments:
.Bl -tag -width ".Fl h Ar method" -offset 3m -compact
.It Fl b Ar bang
Hash-bang line to start the archive (e.g.
.Pa #!/usr/bin/php ) .
The hash mark itself
.Qq #!
and the newline character are optional.
.It Fl p Ar loader
Location of
.Vt PHP_Archive
class file (
.Cm pear list-files PHP_Archive
). You can use '0' or '1' to locate it automatically using the mentioned
.Xr pear 1
command. Passing '0' causes the command to not error out when the class file
cannot be located. This switch also adds some code around the stub so that
class
.Vt PHP_Archive
gets registered as the phar:// stream wrapper if necessary. Finally, this
switch adds the file
.Pa phar.inc
from this package and loads it to ensure class
.Vt Phar
is present.
.It Fl s Ar stub
Select the stub file
.El
.El
.\" -- tree --
.It Cm tree Fl f Ar file Oo Fl i Ar regex Oc Oo Fl x Ar regex Oc
.Bl -item
.It
Optional arguments:
.Bl -tag -width ".Fl h Ar method" -offset 3m -compact
.It Fl i Ar regex
Specifies a regular expression for input files
.It Fl x Ar regex
Regular expression for input files to exclude
.El
.El
.\" -- end of file commands --
.El
.Sh SEE ALSO
For a complete description of Phar see
.Bl -item -offset 4n -compact
.It
.URL http://\:www.php.net/\:manual/\:en/\:book.phar.php
.El
.Xr pear 1 ,
.Xr php 1
.Sh BUGS
You can view the list of known bugs or report any new bug you
found at
.Bl -item -offset 4n -compact
.It
.URL http://\:www.php.net
.El
.Sh AUTHORS
The PHP Group: Thies C. Arntzen, Stig Bakken, Andi Gutmans, Rasmus Lerdorf,
Sam Ruby, Sascha Schumann, Zeev Suraski, Jim Winstead, Andrei Zmievski.
.Pp
Additional work for the CLI sapi was done by Edin Kadribasic, Marcus Boerger
and Johannes Schlueter.
.Pp
A list of active developers can be found on the PHP web site
.Bl -item -offset 4n -compact
.It
.URL http://\:www.php.net/\:credits.php
.El
.Pp
And last but not least PHP was developed with the help of a huge amount of
contributors all around the world.
.Sh VERSION INFORMATION
This manpage describes
.Cm php
version 5.3.3.
.Sh COPYRIGHT
Copyright \(co 1997\-2010 The PHP Group
.Pp
This source file is subject to version 3.01 of the PHP license,
that is bundled with this package in the file LICENSE, and is
available through the world-wide-web at the following url:
.Bl -item -offset 4n -compact
.It
.URL http://\:www.php.net/\:license/\:3_01.txt
.El
.Pp
If you did not receive a copy of the PHP license and are unable to
obtain it through the world-wide-web, please send a note to
.MTO license@php.net
so we can mail you a copy immediately.