forked from facebook/hhvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.compiled
800 lines (640 loc) · 21.9 KB
/
options.compiled
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
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
<h2>Configurable Options for Compiled Program</h2>
Note that, in this documentation, we used "*" for names that the system doesn't
care. In reality, one may always use a string or a name to better describe a
node's purpose. Listed values are defaults, unless examples.
= Logging
Log {
Level = None (default) | Error | Warning | Info | Verbose
NoSilencer = false
AlwaysLogUnhandledExceptions = true
RuntimeErrorReportingLevel = 8191
Header = false
InjectedStackTrace = true
NativeStackTrace = true
MaxMessagesPerRequest = -1
- Level, NoSilencer, AlwaysLogUnhandledExceptions, RuntimeErrorReportingLevel
These settings control different logging levels. NoSilencer means even when
silencer operator @ is used, still output errors. Unhandled exceptions are
PHP fatal errors, and AlwaysLogUnhandledExceptions will make sure they get
logged even if a user's error handler is installed for them. We also provided
RuntimeErrorReportingLevel for compatibility with PHP.
- Header, InjectedStackTrace, NativeStackTrace
These settings control log line formats. Header includes timestamp, process id,
thread id, request id (counted from 1 since server starts), message id
(counted from 1 since request started) and extra header text from command line
option (see util/logger.cpp for implementation).
There are two kinds of stacktraces: (1) C++ stacktrace, which is hex-encoded
and printed on every line of logging right after header. These stacktraces can
be translated into human readable frames by running "-m translate" with the
compiled program. (2) PHP stacktrace from code injection. Generated C++ code
injects stacktrace preparation code into every frame of functions and methods.
InjectedStackTrace can turn on this PHP stacktrace, which sometimes is cleaner
than the C++ stacktrace, which can be turned on and off by NativeStackTrace.
- MaxMessagesPerRequest
Controls maximum number of messages each request can log, in case some pages
flood error logs.
# error log settings
UseLogFile = true
File = filename
# access log settings
AccessLogDefaultFormat = %h %l %u %t \"%r\" %>s %b
Access {
* {
File = filename
Format = some Apache access log format string
}
* {
File = another filename
Format = some Apache access log format string
}
}
# admin server logging
AdminLog {
File = filename
Format = %h %t %s %U
}
# enable or disable hphp_log() that can be called from PHP code
ApplicationLog = true
# Log aggregator logs one line per several errors, grouped by error's
# stacktraces. It can also save errors to a specified database.
Aggregator = false
Aggregator {
File = filename
Database = [username[:password]@]server[:port][/database]
SleepSeconds = 10 # polling cycle for aggregation
}
}
= Error Handling
ErrorHandling {
CallUserHandlerOnFatals = true
MaxLoopCount = 0
NoInfiniteRecursionDetection = false
MaxStackDepth = 1000
ThrowBadTypeExceptions = false
ThrowTooManyArguments = false
WarnTooManyArguments = false
ThrowMissingArguments = false
ThrowInvalidArguments = false
EnableHipHopErrors = true
NoticeFrequency = 1 # 1 out of these many notices to log
WarningFrequency = 1 # 1 out of these many warnings to log
AssertActive = false
AssertWarning = false
}
= Resource Limits
ResourceLimit {
CoreFileSize = 0 # in bytes
MaxSocket = 0
SocketDefaultTimeout = 5 # in seconds
MaxRSS = 0
MaxRSSPollingCycle = 0 # in seconds, how often to check max memory
DropCacheCycle = 0 # in seconds, how often to drop disk cache
MaxSQLRowCount = 0
MaxMemcacheKeyCount = 0
SerializationSizeLimit = 0
StringOffsetLimit = 10 * 1024 * 1024
}
= Server
PidFile = pid filename
# $_SERVER['name'] = value
ServerVariables {
name = value
}
# $_ENV['name'] = value
EnvVariables {
name = value
}
Server {
Host = www.default_domain.com
IP = 0.0.0.0
Port = 80
ThreadCount = 50
ThreadRoundRobin = false # last thread serves next
ThreadDropCacheTimeoutSeconds = 0
ThreadJobLIFO = false
SourceRoot = path to source files and static contents
IncludeSearchPaths {
* = some path
* = another path
}
# Recommend to turn this on when all the file paths in the file invoke
# table are relative for faster dynamic file inclusion.
AlwaysUseRelativePath = false
RequestTimeoutSeconds = -1
RequestMemoryMaxBytes = 0
# maximum POST Content-Length
MaxPostSize = 10MB
# maximum upload file size
UploadMaxFileSize = 10MB
# maximum memory size for image processing
ImageMemoryMaxBytes = UploadMaxFileSize * 2
# Recommend to turn this on to avoid memory leaks and to enable warmup
# document features.
EnableMemoryManager = false
# Only for debugging memory problems. When turned on, server will report
# SmartAllocator's usage for each thread to stdout.
CheckMemory = false
# Recommend to turn this on for faster array operations.
UseZendArray = true
# Faster data structure for arrays of size < 8. Requires UseZendArray=true.
# Recommend to turn this on.
UseSmallArray = true
# If ServerName is not specified for a virtual host, use prefix + this
# suffix to compose one. If "Pattern" was specified, matched pattern,
# either by parentheses for the first match or without parentheses for
# the whole pattern, will be used as prefix for DefaultServerNameSuffix.
DefaultServerNameSuffix = default_domain.com
# Forcing $_SERVER['SERVER_NAME'] to come from request header
ForceServerNameToHeader = false
# startup options
TakeoverFilename = filename # for port takeover between server instances
DefaultDocument = index.php
StartupDocument = filename
WarmupDocument = filename
RequestInitFunction = function_name
RequestInitDocument = filename
ThreadDocuments {
* = somedoc.php
* = another.php
}
ThreadLoopDocuments {
* = somedoc.php
* = another.php
}
ErrorDocument404 = 404.php
ErrorDocument500 = 500.php
FatalErrorMessage = some string
# shutdown options
GracefulShutdownWait = 0 # in seconds
HarshShutdown = true
EvilShutdown = true
DanglingWait = 0
# SSL options
EnableSSL = false
SSLPort = 443
SSLCertificateFile = <certificate file> # similar to apache
SSLCertificateKeyFile = <certificate file> # similar to apache
- GracefulShutdownWait, HarshShutdown, EvilShutdown
Graceful shutdown will try admin /stop command and it waits for number of
seconds specified by GracefulShutdownWait. Harsh shutdown looks for pid file
and try to kill that process. Evil shutdown kills anything listening on the
server port it's trying to grab.
- DanglingWait
How long to wait for dangling server to respond.
# HTTP settings
GzipCompressionLevel = 3
ForceCompression {
# force response to be compressed, even if there isn't accept-encoding
URL = # if URL perfectly matches this
Cookie = # if this cookie is present: "name" or "name=value"
Param = # if this parameter in query string is present
}
EnableMagicQuotesGpc = false
EnableKeepAlive = true
EnableOutputBuffering = false
OutputHandler =
ImplicitFlush = false
EnableEarlyFlush = true
ForceChunkedEncoding = false
MaxPostSize = 8 # in MB
EnableFileUploads = true
LibEventSyncSend = true
ResponseQueueCount = 0
To further control idle connections, set
ConnectionTimeoutSeconds = <some value>
This parameter controls how long libevent will timeout a connection after
idle on read or write. It takes effect when EnableKeepAlive is enabled.
- EnableEarlyFlush, ForceChunkedEncoding
EnableEarlyFlush allows chunked encoding responses, and ForceChunkedEncoding
will only send chunked encoding responses, unless client doesn't understand.
- LibEventSyncSend, ResponseQueueCount
These are fine tuning options for libevent server. LibEventSyncSend allows
response packets to be sent directly from worker thread, normally resulting in
faster server responses. ResponseQueueCount specifies how many response queues
to use for sending.
# static contents
FileCache = filename
EnableStaticContentCache = true
EnableStaticContentFromDisk = true
ExpiresActive = true
ExpiresDefault = 2592000
DefaultCharsetName = UTF-8
- EnableStaticContentCache, EnableStaticContentFromDisk
A static content cache creates one single file from all static contents,
including css, js, html, images and any other non-PHP files (or even PHP files,
if CachePHPFile is turned on for compiler options). Normally this is prepared
by compiler at compilation time, but it can also be prepared at run-time, if
SourceRoot points to real file directory and EnableStaticContentFromDisk is
true. Otherwise, use FileCache to point to the static content cache file
created by the compiler.
NOTE: the FileCache should be set with absolute path
- ExpiresActive, ExpiresDefault, DefaultCharsetName
These control static content's response headers. DefaultCharsetName is also
used for PHP responses in case no other charset has been set explicitly.
# file access control
SafeFileAccess = false
FontPath = where to look for font files
AllowedDirectories {
* = /tmp
}
AllowedFiles {
* = specific file to allow
}
# files with these extensions cannot be executed
ForbiddenFileExtensions {
* = ...
}
APC {
EnableApc = true
UseSharedMemory = false
SharedMemorySize = 1024 # in MB
- UseSharedMemory
When off, APC will use regular process memory for faster access, but only
limited to single process. Shared memory model allows sharing between two or
more processes, but it has SharedMemorySize as upper limit.
PrimeLibrary = filename
LoadThread = 2
CompletionKeys {
* = key name
}
- APC Priming
There is a way to prepare APC items in dry format, serialized in binary files,
and these files can be loaded (or "primed") extremely fast at startup time.
To prepare these .cpp files, check bin/apc_sample_serializer.php for one way
of doing it. Once prepared, we can compiled them into .so that can be loaded
through PrimeLibrary option. The loading can be done in parallel with
LoadThread count of threads. Once loading is done, it can write to APC with
some specified keys in CompletionKeys to tell web application about priming.
TableType = hash (default) | lfu | concurrent
LockType = readwritelock | mutex
UseLockedRefs = false
- TableType, LockType, UseLockedRefs
Recommend to use "concurrent", the fastest with least locking. "lfu" is
experimental for now and it may have bugs. When "concurrent", LockType doesn't
matter. UseLockedRefs uses mutexes than atomic numbers for APC item's reference
counting, so it's recommended to turn off.
ExpireOnSets = false
PurgeFrequency = 4096
- ExpireOnSets, PurgeFrequency
ExpireOnSets turns on item purging on expiration, and it's only done once per
PurgeFrequency of sets.
KeyMaturityThreshold = 20
MaximumCapacity = 0
KeyFrequencyUpdatePeriod = 1000 # in number of accesses
- KeyMaturityThreshold, MaximumCapacity, KeyFrequencyUpdatePeriod
These are experimental LFU settings.
}
# DNS cache
DnsCache {
Enable = false
TTL = 600 # in seconds
KeyMaturityThreshold = 20
MaximumCapacity = 0
KeyFrequencyUpdatePeriod = 1000
}
# Light process has very little forking cost, because they are pre-forked
# Recommend to turn it on for faster shell command execution.
LightProcessFilePrefix = ./lightprocess
LightProcessCount = 0
# RTTI profiling settings. Experimental.
RTTIDirectory = /tmp/
EnableCliRTTI = false
}
= Virtual Hosts
# default IpBlockMap that applies to all URLs, if exists
IpBlockMap {
* {
Location = /url
AllowFirst = false
Ip {
Allow {
* = 127.0.0.1
* = 192.0.0.0/8
}
Deny {
* = 192.1.0.0
}
}
}
}
VirtualHost {
* {
Disabled = false
Prefix = prefix.
Pattern = regex pattern
PathTranslation = html
ServerName =
ServerVariables {
name = value
}
RewriteRules {
* {
pattern = regex pattern same as Apache's
to = target format same as Apache's
qsa = false
redirect = 0 (default: off) | 302 | 301 | other status code
conditions {
* {
pattern = regex pattern to match
type = host | request
negate = false
}
}
}
}
IpBlockMap {
# in same format as the IpBlockMap example above
}
# Remove certain query string parameters from access log.
LogFilters {
* {
# regex pattern to match a URL
url = (empty means matching all URLs)
# names of parameters to remove from query string
params = {
* = parameter name
}
# alternatively, use regex pattern to replace with empty string.
pattern = (empty means hiding entire query string)
# optionally, specify what values to replace with
value = (by default it's empty, removing the query parameter)
}
}
}
}
= Administration Server
AdminServer {
Port = 8088
ThreadCount = 1
Password =
}
= Satellite Servers
Satellites {
* {
Type = RPCServer | InternalPageServer | DanglingPageServer
Port = 0 # disabled
ThreadCount = 5
# only for RPCServer
MaxRequest = 500
MaxDuration = 120 # in seconds
TimeoutSeconds = 30 # default to RequestTimeoutSeconds
WarmupDocument = filename
RequestInitFunction = on_init
RequestInitDocument = filename
Password = authentication
# only for InternalPageServer
BlockMainServer = true
URLs {
* = pattern
}
}
}
- RPCServer, DanglingPageServer
Please refer to their documentations for more details.
- Internal Page Server
Serves internal pages over a private port. These pages will become unavailable
to main HTTP port if BlockMainServer is turned on. Use URLs to specify regex
patterns for pages to server over this port.
Xbox {
ServerInfo {
ThreadCount = 0
Port = 0
MaxRequest = 500
MaxDuration = 120
WarmupDocument =
RequestInitFunction =
RequestInitDocument =
}
ProcessMessageFunc = xbox_process_message
DefaultLocalTimeoutMilliSeconds = 500
DefaultRemoteTimeoutSeconds = 5
}
- Xbox Server
An xbox server provides cross-machine communication, similar to a message
queuing system. It also allows local processing of messages, then working as
a multithreading facility for PHP execution. More documentation will be coming
for xbox applications.
PageletServer {
ThreadCount = 0
}
- Pagelet Server
A pagelet server is essentially the same as local CURL, except it's more
efficient. This allows parallel execution of a web page, preparing two panels
or iframes at the same time.
Fiber {
ThreadCount = 0
}
- Fiber Asynchronous Functions
A "fiber" is a sub-thread of a request thread, mainly for implementing
call_user_func_async(). This thread count specifies totally number of physical
threads allocated for executing fiber asynchronous function calls.
= Proxy Server
Proxy {
Origin = the server to proxy to
Retry = 3
# serve these URLs and proxy all others, trumping ProxyURLs settings
ServeURLs = false
ServeURLs {
* = urls not to proxy
}
# proxy these URLs
ProxyURLs = false
ProxyURLs {
* = urls to proxy
}
# proxy these patterns
ProxyPatterns {
* = patterns to proxy
}
# proxy this percentage of pages
Percentage = 0
}
- ServeURLs, ProxyURLs
Please note that these two settings are mutually exclusive, and you may turn on
just one. When ProxyURLs is on, you may choose to use ProxyURLs, ProxyPatterns
or Percentage or any combination of them to specify how it should be proxied.
= Static Content
StaticFile {
Extensions {
bmp = image/bmp
}
Generators {
* = static_resource.php
}
FilesMatch {
* {
pattern = .*\.(dll|exe)
headers {
* = Content-Disposition: attachment
}
}
}
}
- Generators
In addition to Static Content Cache, we also support Dynamic Content Cache. If
static_resource.php generates identical files given the same HTTP input, it
can be listed under Generators, so its generated content can be cached for
next requests.
= Stats
Stats = false
Stats {
Web = false
Memory = false
Malloc = false
APC = false
APCKey = false
Memcache = false
MemcacheKey = false
SQL = false
SQLTable = false
NetworkIO = false
XSL = xsl filename
XSLProxy = url to get the xsl file
SlotDuration = 600 # in seconds
MaxSlot = 72 # 10 minutes x 72 = 12 hours
APCSize {
Enable = false
CountPrime = false
Group = false
Individual = false
FetchStats = false
SpecialPrefix {
* = sv:/
}
SpecialMiddle {
* = :sv:/
}
}
}
= Debug Settings
Debug {
FullBacktrace = false
ServerStackTrace = false
ServerErrorMessage = false
TranslateSource = false
RecordInput = false
ClearInputOnSuccess = true
ProfilerOutputDir = /tmp
CoreDumpEmail = email address
CoreDumpReport = true
CoreDumpReportDirectory = /tmp
LocalMemcache = false
MemcacheReadOnly = false
}
- FullBacktrace, ServerStackTrace, ServerErrorMessage, TranslateSource
These settings turn on error messages in HTTP responses with detailed
stacktrace information. TranslateSource will translate C++ file and line
numbers into original PHP file and line numbers.
- RecordInput, ClearInputOnSuccess
With these two settings, we can easily capture an HTTP request in a file that
can be replayed with "-m replay" from the compiled program at command line.
We can easily gdb that way to debug any problems. Watch error log for recorded
file's location. ClearInputOnSuccess can automatically delete requests that
had 200 responses and it's useful to capture 500 errors on production without
capturing good responses.
- APCSize
There are options for APC size profiling. If enabled, APC overall size will be
updated every time a store or delete happens. This allows querying apc stats
on admin port. 'CountPrime' controls whether size stats includes primed keys.
'Group' controls whether stats break-down by key groups get profiled.
'SpecialPrefix' and 'SpecialMiddle' are used for aggregating some keys groups.
'Individual' controls whether size profiling is enabled for each key, which
could incur some space overhead. 'FetchStats' can be enabled to also profile
apc_fetch, which further increases time overhead.
'FetchStats' implies 'Individual', and 'Individual' implies 'Group'
= Sandbox Environment
A sandbox has pre-defined setup that maps some directory to be source root of
a web server, hence eliminating a lot of setups.
Sandbox {
SandboxMode = false
Pattern = www.[user]-[sandbox].[machine].facebook.com
Home = /home
ConfFile = ~/.hphp
ServerVariables {
name = value
}
}
- Sandbox Configuration
First, pick a name. "default" has special meaning, then URL would be
www.[user].[machine].facebook.com. Say the name is "sandbox", the configuration
will look like this,
[sandbox].path = path
[sandbox].log = path
[sandbox].accesslog = path
"path" points to PHP source files. "log" points to error log location and
"accesslog" points to access log location.
- Machine Sharing
The benefit is, same server can have one "Sandbox" configuration, and many
users can use the same machine serving their own source files.
= HPHPi Settings
Eval {
EnableHipHopSyntax = false
EnableHipHopExperimentalSyntax = false
EnableShortTags = true # is <? allowed
EnableAspTags = false # is <% %> allowed
EnableXHP = true # XHP extension
NativeXHP = true # Use HPHP to directly handle XHP
# error level, strict mode is a lot more picky about coding errors
EnableStrict = false
StrictLevel = 1 # StrictBasic
StrictFatal = false
# debugger
Debugger {
EnableDebugger = false
EnableDebuggerServer = false
Port = 8089
StartupDocument =
DefaultSandboxPath =
RPC {
DefaultPort = 8083
DefaultAuth =
HostDomain =
DefaultTimeout = 30
}
}
# experimental, please ignore
BytecodeInterpreter = false
DumpBytecode = false
RecordCodeCoverage = false
CodeCoverageOutputFile =
}
= MySQL
MySQL {
ReadOnly = false
Localize = false # true for native driver that's faster
ConnectTimeout = 1000 # in ms
ReadTimeout = 1000 # in ms
WaitTimeout = -1 # in ms, -1 means "don't set"
SlowQueryThreshold = 1000 # in ms, log slow queries as errors
KillOnTimeout = false
}
- KillOnTimeout
When a query takes long time to execute on server, client has a chance to
kill it to avoid extra server cost by turning on KillOnTimeout.
= HTTP Monitoring
Http {
DefaultTimeout = 30 # in seconds
SlowQueryThreshold = 5000 # in ms, log slow HTTP requests as errors
}
= Mail
Mail {
SendmailPath = sendmail -t -i
ForceExtraParameters =
}
= PCRE
Preg {
BacktraceLimit = 100000
RecursionLimit = 100000
}
= Tier overwrites
Tiers {
* {
machine = /regex pattern/
overwrite {
# any config settings described in this documentation
}
}
}
This feature allows a machine to overwrite configurations just by matching
machine names with specified regex pattern. This block of configuration can
appear at any location of the file, even at top.