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.
10 Level = None (default) | Error | Warning | Info | Verbose
12 AlwaysLogUnhandledExceptions = true
13 RuntimeErrorReportingLevel = 8191
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.
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
62 AccessLogDefaultFormat = %h %l %u %t \"%r\" %>s %b
66 Format = some Apache access log format string
69 File = another filename
70 Format = some Apache access log format string
74 # admin server logging
84 CallUserHandlerOnFatals = true
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
102 CoreFileSize = 0 # in bytes
104 SocketDefaultTimeout = 5 # in seconds
106 MaxRSSPollingCycle = 0 # in seconds, how often to check max memory
107 DropCacheCycle = 0 # in seconds, how often to drop disk cache
109 SerializationSizeLimit = 0
110 StringOffsetLimit = 10 * 1024 * 1024
115 PidFile = pid filename
117 # $_SERVER['name'] = value
122 # $_ENV['name'] = value
128 Host = www.default_domain.com
132 ThreadRoundRobin = false # last thread serves next
133 ThreadDropCacheTimeoutSeconds = 0
134 ThreadJobLIFO = false
136 SourceRoot = path to source files and static contents
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
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
162 # Print file paths traversed onto the 404 page
166 TakeoverFilename = filename # for port takeover between server instances
167 DefaultDocument = index.php
168 StartupDocument = filename
169 RequestInitFunction = function_name
170 RequestInitDocument = filename
175 ThreadLoopDocuments {
179 ErrorDocument404 = 404.php
180 ErrorDocument500 = 500.php
181 FatalErrorMessage = some string
184 GracefulShutdownWait = 0 # in seconds
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.
204 How long to wait for dangling server to respond.
207 GzipCompressionLevel = 3
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
214 EnableMagicQuotesGpc = false
215 EnableKeepAlive = true
216 EnableOutputBuffering = false
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
244 EnableStaticContentFromDisk = 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
273 * = specific file to allow
276 # files with these extensions cannot be executed
277 ForbiddenFileExtensions {
283 PrimeLibrary = filename
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)
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).
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
317 KeyFrequencyUpdatePeriod = 1000 # in number of accesses
319 - KeyMaturityThreshold, MaximumCapacity, KeyFrequencyUpdatePeriod
321 These are experimental LFU settings.
328 TTL = 600 # in seconds
329 KeyMaturityThreshold = 20
331 KeyFrequencyUpdatePeriod = 1000
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
341 UploadMaxFileSize = 100 # Size in MB
343 EnableFileUploads = true
344 EnableUploadProgress = false
345 Rfc1867Freq = 262144 # 256K
346 Rfc1867Prefix = vupload_
347 Rfc1867Name = video_ptoken
350 IniFile = "/etc/hhvm/php.ini"
355 # default IpBlockMap that applies to all URLs, if exists
376 Pattern = regex pattern
377 PathTranslation = html
378 CheckExistenceBeforeRewrite = true
386 pattern = regex pattern same as Apache's
387 to = target format same as Apache's
389 redirect = 0 (default: off) | 302 | 301 | other status code
393 pattern = regex pattern to match
394 type = host | request
402 # in same format as the IpBlockMap example above
405 # Remove certain query string parameters from access log.
408 # regex pattern to match a URL
409 url = (empty means matching all URLs)
411 # names of parameters to remove from query string
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)
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
444 Type = RPCServer | InternalPageServer | DanglingPageServer
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
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.
481 RequestInitFunction =
482 RequestInitDocument =
484 ProcessMessageFunc = xbox_process_message
485 DefaultLocalTimeoutMilliSeconds = 500
486 DefaultRemoteTimeoutSeconds = 5
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.
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.
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.
519 Origin = the server to proxy to
522 # serve these URLs and proxy all others, trumping ProxyURLs settings
525 * = urls not to proxy
533 # proxy these patterns
535 * = patterns to proxy
537 # proxy this percentage of pages
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.
554 * = static_resource.php
558 pattern = .*\.(dll|exe)
560 * = Content-Disposition: attachment
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
587 XSLProxy = url to get the xsl file
589 SlotDuration = 600 # in seconds
590 MaxSlot = 72 # 10 minutes x 72 = 12 hours
610 FullBacktrace = false
611 ServerStackTrace = false
612 ServerErrorMessage = false
613 TranslateSource = false
616 ClearInputOnSuccess = true
618 ProfilerOutputDir = /tmp
620 CoreDumpEmail = email address
621 CoreDumpReport = true
622 CoreDumpReportDirectory = /tmp
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.
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.
659 Pattern = www.[user]-[sandbox].[machine].facebook.com
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
674 [sandbox].path = 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:
688 EnableDebugger = true
689 EnableDebuggerServer = true
691 DefaultSandboxPath = path to source files, similar to Server.SourceRoot
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.
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.
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
720 EnableDebugger = false
721 EnableDebuggerServer = false
734 TimeoutsUseWallTime = true
735 CheckFlushOnUserClose = true
737 # experimental, please ignore
738 BytecodeInterpreter = false
740 RecordCodeCoverage = false
741 CodeCoverageOutputFile =
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.
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
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.
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.
790 DefaultTimeout = 30 # in seconds
791 SlowQueryThreshold = 5000 # in ms, log slow HTTP requests as errors
797 SendmailPath = sendmail -t -i
798 ForceExtraParameters =
804 BacktraceLimit = 100000
805 RecursionLimit = 100000
812 machine = /regex pattern/
814 # any config settings described in this documentation
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.
832 phpt = application/x-phpt
833 hphp = application/x-hhvm-php
837 The content type is not used and is just for descriptive purposes.