Use folly::dynamic::object and folly::dynamic::string exclusivly
[hiphop-php.git] / hphp / doc / options.compiled
blob3c03f5983eb7f8bfc5d9ac6cb580c199f8b2a3d1
1 <h2>Configurable Options for Compiled Program</h2>
3 Note that, in this documentation, we used "*" for names that the system doesn't
4 care. In reality, one may always use a string or a name to better describe a
5 node's purpose. Listed values are defaults, unless examples.
7 = Logging
9   Log {
10     Level = None (default) | Error | Warning | Info | Verbose
11     NoSilencer = false
12     AlwaysLogUnhandledExceptions = true
13     RuntimeErrorReportingLevel = 8191
14     Header = false
15     HeaderMangle = 0
16     InjectedStackTrace = true
17     NativeStackTrace = true
18     MaxMessagesPerRequest = -1
20 - Level, NoSilencer, AlwaysLogUnhandledExceptions, RuntimeErrorReportingLevel
22 These settings control different logging levels. NoSilencer means even when
23 silencer operator @ is used, still output errors. Unhandled exceptions are
24 PHP fatal errors, and AlwaysLogUnhandledExceptions will make sure they get
25 logged even if a user's error handler is installed for them. We also provided
26 RuntimeErrorReportingLevel for compatibility with PHP.
28 - Header, InjectedStackTrace, NativeStackTrace
30 These settings control log line formats. Header includes timestamp, process id,
31 thread id, request id (counted from 1 since server starts), message id
32 (counted from 1 since request started) and extra header text from command line
33 option (see util/logger.cpp for implementation).
35 There are two kinds of stacktraces: (1) C++ stacktrace, which is hex-encoded
36 and printed on every line of logging right after header. These stacktraces can
37 be translated into human readable frames by running "-m translate" with the
38 compiled program. (2) PHP stacktrace from code injection. Generated C++ code
39 injects stacktrace preparation code into every frame of functions and methods.
40 InjectedStackTrace can turn on this PHP stacktrace, which sometimes is cleaner
41 than the C++ stacktrace, which can be turned on and off by NativeStackTrace.
43 - HeaderMangle
45 This setting controls logging of potentially malicious headers.  If
46 HeaderMangle is greater than 0, then HipHop will log one in every n
47 requests where a header collision has occurred.  Such collisions
48 almost certainly indicate a malicious attempt to set headers which are
49 either set or filtered by a proxy.
51 - MaxMessagesPerRequest
53 Controls maximum number of messages each request can log, in case some pages
54 flood error logs.
56     # error log settings
57     UseLogFile = true
58     File = filename
59     UseSyslog = false
61     # access log settings
62     AccessLogDefaultFormat = %h %l %u %t \"%r\" %>s %b
63     Access {
64       * {
65         File = filename
66         Format = some Apache access log format string
67       }
68       * {
69         File = another filename
70         Format = some Apache access log format string
71       }
72     }
74     # admin server logging
75     AdminLog {
76       File = filename
77       Format = %h %t %s %U
78     }
79   }
81 = Error Handling
83   ErrorHandling {
84     CallUserHandlerOnFatals = true
85     MaxLoopCount = 0
86     NoInfiniteRecursionDetection = false
87     ThrowBadTypeExceptions = false
88     ThrowTooManyArguments = false
89     WarnTooManyArguments = false
90     ThrowMissingArguments = false
91     ThrowInvalidArguments = false
92     EnableHipHopErrors = true
93     NoticeFrequency = 1    # 1 out of these many notices to log
94     WarningFrequency = 1   # 1 out of these many warnings to log
95     AssertActive = false
96     AssertWarning = false
97   }
99 = Resource Limits
101   ResourceLimit {
102     CoreFileSize = 0          # in bytes
103     MaxSocket = 0
104     SocketDefaultTimeout = 5  # in seconds
105     MaxRSS = 0
106     MaxRSSPollingCycle = 0    # in seconds, how often to check max memory
107     DropCacheCycle = 0        # in seconds, how often to drop disk cache
108     MaxSQLRowCount = 0
109     SerializationSizeLimit = 0
110     StringOffsetLimit = 10 * 1024 * 1024
111   }
113 = Server
115   PidFile = pid filename
117   # $_SERVER['name'] = value
118   ServerVariables {
119     name = value
120   }
122   # $_ENV['name'] = value
123   EnvVariables {
124     name = value
125   }
127   Server {
128     Host = www.default_domain.com
129     IP = 0.0.0.0
130     Port = 80
131     ThreadCount = 50
132     ThreadRoundRobin = false   # last thread serves next
133     ThreadDropCacheTimeoutSeconds = 0
134     ThreadJobLIFO = false
136     SourceRoot = path to source files and static contents
137     IncludeSearchPaths {
138       * = some path
139       * = another path
140     }
141     # Recommend to turn this on when all the file paths in the file invoke
142     # table are relative for faster dynamic file inclusion.
143     AlwaysUseRelativePath = false
145     RequestTimeoutSeconds = -1
146     RequestMemoryMaxBytes = 0
148     # maximum POST Content-Length
149     MaxPostSize = 10MB
150     # maximum memory size for image processing
151     ImageMemoryMaxBytes = Upload.UploadMaxFileSize * 2
153     # If ServerName is not specified for a virtual host, use prefix + this
154     # suffix to compose one. If "Pattern" was specified, matched pattern,
155     # either by parentheses for the first match or without parentheses for
156     # the whole pattern, will be used as prefix for DefaultServerNameSuffix.
157     DefaultServerNameSuffix = default_domain.com
159     # Forcing $_SERVER['SERVER_NAME'] to come from request header
160     ForceServerNameToHeader = false
161     
162     # Print file paths traversed onto the 404 page
163     PathDebug = false
165     # startup options
166     TakeoverFilename = filename   # for port takeover between server instances
167     DefaultDocument = index.php
168     StartupDocument = filename
169     RequestInitFunction = function_name
170     RequestInitDocument = filename
171     ThreadDocuments {
172       * = somedoc.php
173       * = another.php
174     }
175     ThreadLoopDocuments {
176       * = somedoc.php
177       * = another.php
178     }
179     ErrorDocument404 = 404.php
180     ErrorDocument500 = 500.php
181     FatalErrorMessage = some string
183     # shutdown options
184     GracefulShutdownWait = 0   # in seconds
185     HarshShutdown = true
186     EvilShutdown = true
187     DanglingWait = 0
189     # SSL options
190     EnableSSL = false
191     SSLPort = 443
192     SSLCertificateFile = <certificate file> # similar to apache
193     SSLCertificateKeyFile = <certificate file> # similar to apache
195 - GracefulShutdownWait, HarshShutdown, EvilShutdown
197 Graceful shutdown will try admin /stop command and it waits for number of
198 seconds specified by GracefulShutdownWait. Harsh shutdown looks for pid file
199 and try to kill that process. Evil shutdown kills anything listening on the
200 server port it's trying to grab.
202 - DanglingWait
204 How long to wait for dangling server to respond.
206     # HTTP settings
207     GzipCompressionLevel = 3
208     ForceCompression {
209       # force response to be compressed, even if there isn't accept-encoding
210       URL =         # if URL perfectly matches this
211       Cookie =      # if this cookie is present: "name" or "name=value"
212       Param =       # if this parameter in query string is present
213     }
214     EnableMagicQuotesGpc = false
215     EnableKeepAlive = true
216     EnableOutputBuffering = false
217     OutputHandler =
218     ImplicitFlush = false
219     EnableEarlyFlush = true
220     ForceChunkedEncoding = false
221     MaxPostSize = 8  # in MB
222     LibEventSyncSend = true
223     ResponseQueueCount = 0
225 To further control idle connections, set
226     ConnectionTimeoutSeconds = <some value>
227 This parameter controls how long libevent will timeout a connection after
228 idle on read or write. It takes effect when EnableKeepAlive is enabled.
230 - EnableEarlyFlush, ForceChunkedEncoding
232 EnableEarlyFlush allows chunked encoding responses, and ForceChunkedEncoding
233 will only send chunked encoding responses, unless client doesn't understand.
235 - LibEventSyncSend, ResponseQueueCount
237 These are fine tuning options for libevent server. LibEventSyncSend allows
238 response packets to be sent directly from worker thread, normally resulting in
239 faster server responses. ResponseQueueCount specifies how many response queues
240 to use for sending.
242     # static contents
243     FileCache = filename
244     EnableStaticContentFromDisk = true
245     ExpiresActive = true
246     ExpiresDefault = 2592000
247     DefaultCharsetName = UTF-8
249 - EnableStaticContentFromDisk
251 A static content cache creates one single file from all static contents,
252 including css, js, html, images and any other non-PHP files (or even PHP files,
253 if CachePHPFile is turned on for compiler options). Normally this is prepared
254 by compiler at compilation time, but it can also be prepared at run-time, if
255 SourceRoot points to real file directory and EnableStaticContentFromDisk is
256 true. Otherwise, use FileCache to point to the static content cache file
257 created by the compiler.
259 NOTE: the FileCache should be set with absolute path
261 - ExpiresActive, ExpiresDefault, DefaultCharsetName
263 These control static content's response headers. DefaultCharsetName is also
264 used for PHP responses in case no other charset has been set explicitly.
266     # file access control
267     SafeFileAccess = false
268     FontPath = where to look for font files
269     AllowedDirectories {
270       * = /tmp
271     }
272     AllowedFiles {
273       * = specific file to allow
274     }
276     # files with these extensions cannot be executed
277     ForbiddenFileExtensions {
278       * = ...
279     }
281     APC {
282       EnableApc = true
283       PrimeLibrary = filename
284       LoadThread = 2
285       CompletionKeys {
286         * = key name
287       }
289 - APC Priming
291 There is a way to prepare APC items in dry format, serialized in binary files,
292 and these files can be loaded (or "primed") extremely fast at startup time.
293 To prepare these .cpp files, check apc_sample_serializer.php for one way
294 of doing it. Once prepared, we can compiled them into .so that can be loaded
295 through PrimeLibrary option. The loading can be done in parallel with
296 LoadThread count of threads. Once loading is done, it can write to APC with
297 some specified keys in CompletionKeys to tell web application about priming.
299       TableType = concurrent (default)
301 - TableType
303 Recommend to use "concurrent", the fastest with least locking, and since its
304 the only implemented table type.  (The option remains for future use if we
305 add other apc implementations).
307       ExpireOnSets = false
308       PurgeFrequency = 4096
310 - ExpireOnSets, PurgeFrequency
312 ExpireOnSets turns on item purging on expiration, and it's only done once per
313 PurgeFrequency of sets.
315       KeyMaturityThreshold = 20
316       MaximumCapacity = 0
317       KeyFrequencyUpdatePeriod = 1000  # in number of accesses
319 - KeyMaturityThreshold, MaximumCapacity, KeyFrequencyUpdatePeriod
321 These are experimental LFU settings.
323     }
325     # DNS cache
326     DnsCache {
327       Enable = false
328       TTL = 600   # in seconds
329       KeyMaturityThreshold = 20
330       MaximumCapacity = 0
331       KeyFrequencyUpdatePeriod = 1000
332     }
334     # Light process has very little forking cost, because they are pre-forked
335     # Recommend to turn it on for faster shell command execution.
336     LightProcessFilePrefix = ./lightprocess
337     LightProcessCount = 0
339     # Uploads
340     Upload {
341       UploadMaxFileSize = 100 # Size in MB
342       UploadTmpDir = /tmp/
343       EnableFileUploads = true
344       EnableUploadProgress = false
345       Rfc1867Freq = 262144 # 256K
346       Rfc1867Prefix = vupload_
347       Rfc1867Name = video_ptoken
348     }
350     IniFile = "/etc/hhvm/php.ini"
351   }
353 = Virtual Hosts
355   # default IpBlockMap that applies to all URLs, if exists
356   IpBlockMap {
357     * {
358       Location = /url
359       AllowFirst = false
360       Ip {
361         Allow {
362           * = 127.0.0.1
363           * = 192.0.0.0/8
364         }
365         Deny {
366           * = 192.1.0.0
367         }
368       }
369     }
370   }
372   VirtualHost {
373     * {
374       Disabled = false
375       Prefix = prefix.
376       Pattern = regex pattern
377       PathTranslation = html
378       CheckExistenceBeforeRewrite = true
379       ServerName =
380       ServerVariables {
381         name = value
382       }
384       RewriteRules {
385         * {
386           pattern = regex pattern same as Apache's
387           to = target format same as Apache's
388           qsa = false
389           redirect = 0 (default: off) | 302 | 301 | other status code
391           conditions {
392             * {
393               pattern = regex pattern to match
394               type = host | request
395               negate = false
396             }
397           }
398         }
399       }
401       IpBlockMap {
402         # in same format as the IpBlockMap example above
403       }
405       # Remove certain query string parameters from access log.
406       LogFilters {
407         * {
408           # regex pattern to match a URL
409           url = (empty means matching all URLs)
411           # names of parameters to remove from query string
412           params = {
413             * = parameter name
414           }
416           # alternatively, use regex pattern to replace with empty string.
417           pattern = (empty means hiding entire query string)
419           # optionally, specify what values to replace with
420           value = (by default it's empty, removing the query parameter)
421         }
422       }
423     }
424   }
426 - CheckExistenceBeforeRewrite
428 With this setting, rewrite rules will not be applied for files that exist in
429 the original path. This is the default behavior. Set this to false if one wants
430 to block access to certain files (ex. .htaccess.)
432 = Administration Server
434   AdminServer {
435     Port = 8088
436     ThreadCount = 1
437     Password =
438   }
440 = Satellite Servers
442   Satellites {
443     * {
444       Type = RPCServer | InternalPageServer | DanglingPageServer
446       Port = 0  # disabled
447       ThreadCount = 5
449       # only for RPCServer
450       MaxRequest = 500
451       MaxDuration = 120    # in seconds
452       TimeoutSeconds = 30  # default to RequestTimeoutSeconds
453       RequestInitFunction = on_init
454       RequestInitDocument = filename
455       Password = authentication
457       # only for InternalPageServer
458       BlockMainServer = true
459       URLs {
460         * = pattern
461       }
462     }
463   }
465 - RPCServer, DanglingPageServer
467 Please refer to their documentations for more details.
469 - Internal Page Server
471 Serves internal pages over a private port. These pages will become unavailable
472 to main HTTP port if BlockMainServer is turned on. Use URLs to specify regex
473 patterns for pages to server over this port.
475   Xbox {
476     ServerInfo {
477       ThreadCount = 0
478       Port = 0
479       MaxRequest = 500
480       MaxDuration = 120
481       RequestInitFunction =
482       RequestInitDocument =
483     }
484     ProcessMessageFunc = xbox_process_message
485     DefaultLocalTimeoutMilliSeconds = 500
486     DefaultRemoteTimeoutSeconds = 5
487   }
489 - Xbox Server
491 An xbox server provides cross-machine communication, similar to a message
492 queuing system. It also allows local processing of messages, then working as
493 a multithreading facility for PHP execution. More documentation will be coming
494 for xbox applications.
496   PageletServer {
497     ThreadCount = 0
498   }
500 - Pagelet Server
502 A pagelet server is essentially the same as local CURL, except it's more
503 efficient. This allows parallel execution of a web page, preparing two panels
504 or iframes at the same time.
506   Fiber {
507     ThreadCount = 0
508   }
510 - Fiber Asynchronous Functions
512 A "fiber" is a sub-thread of a request thread, mainly for implementing
513 call_user_func_async(). This thread count specifies totally number of physical
514 threads allocated for executing fiber asynchronous function calls.
516 = Proxy Server
518   Proxy {
519     Origin = the server to proxy to
520     Retry = 3
522     # serve these URLs and proxy all others, trumping ProxyURLs settings
523     ServeURLs = false
524     ServeURLs {
525       * = urls not to proxy
526     }
528     # proxy these URLs
529     ProxyURLs = false
530     ProxyURLs {
531       * = urls to proxy
532     }
533     # proxy these patterns
534     ProxyPatterns {
535       * = patterns to proxy
536     }
537     # proxy this percentage of pages
538     Percentage = 0
539   }
541 - ServeURLs, ProxyURLs
543 Please note that these two settings are mutually exclusive, and you may turn on
544 just one. When ProxyURLs is on, you may choose to use ProxyURLs, ProxyPatterns
545 or Percentage or any combination of them to specify how it should be proxied.
547 = Static Content
549   StaticFile {
550     Extensions {
551       bmp = image/bmp
552     }
553     Generators {
554       * = static_resource.php
555     }
556     FilesMatch {
557       * {
558         pattern = .*\.(dll|exe)
559         headers {
560           * = Content-Disposition: attachment
561         }
562       }
563     }
564   }
566 - Generators
568 In addition to Static Content Cache, we also support Dynamic Content Cache. If
569 static_resource.php generates identical files given the same HTTP input, it
570 can be listed under Generators, so its generated content can be cached for
571 next requests.
573 = Stats
575   Stats = false
576   Stats {
577     Web = false
578     Memory = false
579     Malloc = false
580     APC = false
581     APCKey = false
582     SQL = false
583     SQLTable = false
584     NetworkIO = false
586     XSL = xsl filename
587     XSLProxy = url to get the xsl file
589     SlotDuration = 600  # in seconds
590     MaxSlot = 72        # 10 minutes x 72 = 12 hours
592     APCSize {
593       Enable = false
594       CountPrime = false
595       Group = false
596       Individual = false
597       FetchStats = false
598       SpecialPrefix {
599         * = sv:/
600       }
601       SpecialMiddle {
602         * = :sv:/
603       }
604     }
605   }
607 = Debug Settings
609   Debug {
610     FullBacktrace = false
611     ServerStackTrace = false
612     ServerErrorMessage = false
613     TranslateSource = false
615     RecordInput = false
616     ClearInputOnSuccess = true
618     ProfilerOutputDir = /tmp
620     CoreDumpEmail = email address
621     CoreDumpReport = true
622     CoreDumpReportDirectory = /tmp
623   }
625 - FullBacktrace, ServerStackTrace, ServerErrorMessage, TranslateSource
627 These settings turn on error messages in HTTP responses with detailed
628 stacktrace information. TranslateSource will translate C++ file and line
629 numbers into original PHP file and line numbers.
631 - RecordInput, ClearInputOnSuccess
633 With these two settings, we can easily capture an HTTP request in a file that
634 can be replayed with "-m replay" from the compiled program at command line.
635 We can easily gdb that way to debug any problems. Watch error log for recorded
636 file's location. ClearInputOnSuccess can automatically delete requests that
637 had 200 responses and it's useful to capture 500 errors on production without
638 capturing good responses.
640 - APCSize
642 There are options for APC size profiling. If enabled, APC overall size will be
643 updated every time a store or delete happens. This allows querying apc stats
644 on admin port. 'CountPrime' controls whether size stats includes primed keys.
645 'Group' controls whether stats break-down by key groups get profiled.
646 'SpecialPrefix' and 'SpecialMiddle' are used for aggregating some keys groups.
647 'Individual' controls whether size profiling is enabled for each key, which
648 could incur some space overhead. 'FetchStats' can be enabled to also profile
649 apc_fetch, which further increases time overhead.
650 'FetchStats' implies 'Individual', and 'Individual' implies 'Group'
652 = Sandbox Environment
654 A sandbox has pre-defined setup that maps some directory to be source root of
655 a web server, hence eliminating a lot of setups.
657   Sandbox {
658     SandboxMode = false
659     Pattern = www.[user]-[sandbox].[machine].facebook.com
660     Home = /home
661     ConfFile = ~/.hphp
663     ServerVariables {
664       name = value
665     }
666   }
668 - Sandbox Configuration
670 First, pick a name. "default" has special meaning, then URL would be
671 www.[user].[machine].facebook.com. Say the name is "sandbox", the configuration
672 will look like this,
674   [sandbox].path = path
675   [sandbox].log = path
676   [sandbox].accesslog = path
678 "path" points to PHP source files. "log" points to error log location and
679 "accesslog" points to access log location.
681 == Debugger Configuration
683 By default, HHVM does not listen for connections from the HipHop
684 Debugger (hphpd). To enable this you need to first setup the sandbox
685 environment described above, then add the following to your config:
687   Eval.Debugger {
688     EnableDebugger = true
689     EnableDebuggerServer = true
690     Port = 8089
691     DefaultSandboxPath = path to source files, similar to Server.SourceRoot
692   }
694 This will cause HHVM to start a debugger server, and you should see an
695 entry in the log indicating the debugger server has started before the
696 entry about all servers having been started.
698 - Machine Sharing
700 The benefit is, same server can have one "Sandbox" configuration, and many
701 users can use the same machine serving their own source files.
703 = HPHPi Settings
705   Eval {
706     CheckSymLink = true
708     EnableHipHopSyntax = false
709     EnableHipHopExperimentalSyntax = false
711     EnableShortTags = true   # is <? allowed
712     EnableAspTags = false    # is <% %> allowed
713     EnableXHP = true         # XHP extension
714     NativeXHP = true         # Use HPHP to directly handle XHP
716     VMStackElms = 16384      # Maximum stack size
718     # debugger
719     Debugger {
720       EnableDebugger = false
721       EnableDebuggerServer = false
722       Port = 8089
723       StartupDocument =
724       DefaultSandboxPath =
726       RPC {
727         DefaultPort = 8083
728         DefaultAuth =
729         HostDomain =
730         DefaultTimeout = 30
731       }
732     }
734     TimeoutsUseWallTime = true
735     CheckFlushOnUserClose = true
737     # experimental, please ignore
738     BytecodeInterpreter = false
739     DumpBytecode = false
740     RecordCodeCoverage = false
741     CodeCoverageOutputFile =
742   }
744 - CheckSymLink
746 Determines whether or not to follow symlinks (and, from a performance
747 standpoint, make the associated realpath() calls needed) when resolving
748 includes/requires and loading code. This is enabled by default for parity with
749 the reference implementation. If not needed for a particular application and/or
750 configuration, disable this when tuning.
752 - TimeoutsUseWallTime
754 Determines whether or not to interpret set_time_limit timeouts as wall time or
755 CPU time (which the reference implementation uses.) Defaults to wall time.
757 - CheckFlushOnUserClose
759 Determines whether or not close() for user streams (registered by
760 stream_wrapper_register) will consider the return value of the implicit call to
761 flush() when calculating its return value.
763 = MySQL
765   MySQL {
766     ReadOnly = false
767     ConnectTimeout = 1000      # in ms
768     ReadTimeout = 1000         # in ms
769     WaitTimeout = -1           # in ms, -1 means "don't set"
770     SlowQueryThreshold = 1000  # in ms, log slow queries as errors
771     KillOnTimeout = false
772     Socket =                   # Default location to look for mysql.sock
773     TypedResults = true
774   }
776 - KillOnTimeout
778 When a query takes long time to execute on server, client has a chance to
779 kill it to avoid extra server cost by turning on KillOnTimeout.
781 - TypedResults
783 Zend returns strings and NULL only for MySQL results, not integers or floats.
784 HHVM return ints (and, sometimes, actual doubles). This behavior can be
785 disabled by setting TypedResults to false.
787 = HTTP Monitoring
789   Http {
790     DefaultTimeout = 30         # in seconds
791     SlowQueryThreshold = 5000   # in ms, log slow HTTP requests as errors
792   }
794 = Mail
796   Mail {
797     SendmailPath = sendmail -t -i
798     ForceExtraParameters =
799   }
801 = PCRE
803   Preg {
804    BacktraceLimit = 100000
805    RecursionLimit = 100000
806   }
808 =  Tier overwrites
810   Tiers {
811     * {
812       machine = /regex pattern/
813       overwrite {
814         # any config settings described in this documentation
815       }
816     }
817   }
819 This feature allows a machine to overwrite configurations just by matching
820 machine names with specified regex pattern. This block of configuration can
821 appear at any location of the file, even at top.
823 = PHP File Extensions
825 By default any file with .php in the URL is treated as PHP source code and is
826 passed through to the execution engine for processing. This configuration option
827 allows other file extensions to be treated similarly. Note that .php is
828 automatically treated as such and does not need to be specified in this list.
830     PhpFile {
831         Extensions {
832             phpt = application/x-phpt
833             hphp = application/x-hhvm-php
834         }
835     }
837 The content type is not used and is just for descriptive purposes.