Skip to main content

INI Settings

Here is the raw list of all possible ini settings that can go in your /etc/hhvm/php.ini, /etc/hhvm/server.ini or any custom .ini file. Not all of them are useful to the HHVM end user. There is lots of cleanup work to do here, but for now you get sorted lists.

Any setting prefixed with hhvm. are HHVM-specific options.

Supported PHP INI Settings

Here is the supported list of PHP INI settings for HHVM. The documentation for each is available when you click the option.

In addition to the PHP settings below, you can use curl.namedPools to initialize named connection pools via a comma-separated list.

@@ guides-generated-markdown/php_ini_support_in_hhvm.md @@

Common Options

These are the options that are probably the most commonly used on a day-to-day basis by users of HHVM.

SettingTypeDefaultDescription
hhvm.server_variablesarray$_SERVERSets the contents of the $_SERVER variable.
hhvm.enable_obj_destruct_callboolfalseIf false, __destruct() methods will not be called on an object at the end of the request. This can be a performance benefit if your system and application can handle the memory requirements. Deallocation can occur all at one time. If true, then HHVM will run all __destruct() methods in the usual way.
hhvm.hack.lang.look_for_typecheckerbooltrueWhen true, HHVM will only process Hack <?hh files if the Hack typechecker server is available and running. You normally turn this off in production and it will be turned off automatically in repo authoritative mode.
hhvm.jitbooltrueEnables the JIT compiler. This is turned on by default for all supported distributions. Times when you might want to turn this off is for a short running script that may not make use of the JIT.
hhvm.jit_enable_rename_functionboolfalseIf false, fb_rename_function() will throw a fatal error. And HHVM knowing that functions cannot be renamed can increase performance.
hhvm.server.thread_countint2x the number of CPU coresThis specifies the number of worker threads used to serve web traffic in server mode. The number to set here is really quite experimental. If you use async, then this number can be the default. Otherwise, you might want a higher number.
hhvm.server.source_rootstringworking directory of HHVM processFor server mode, this will hold the path to the root of the directory of the code being served up. This setting is useless in repo-authoritative mode.
hhvm.force_hhboolfalseIf true, all code is treated as Hack code, even if it starts with <?php. This setting affects hhvm.enable_xhp by forcing it to be true as well. This setting affects hhvm.hack.lang.ints_overflows_to_ints and hhvm.log.always_log_unhandled_exceptions by being the default value for them when they is not explicitly set. This setting affects hhvm.server.allow_duplicate_cookies by being the opposite value for a default when it is not explicitly set.
hhvm.log.filestringstandard error (stderr)The location of the HHVM error log file. If hhvm.log.use_cronolog is set, then this setting will be used as the cron output file.
hhvm.repo.authoritativebooleanfalseIf true, you are specifying that you will be using HHVM's repo-authoritative mode to serve requests.
hhvm.repo.pathstring""The path to the hhvm.hhbc file created when you compiled a repo-authoritative repo. (before HHVM 4.115: hhvm.repo.central.path)
hhvm.server.typestring"Proxygen"The type of server you want to serve up requests for the HHVM server. The default is "proxygen", but you can also specify "fastcgi".
hhvm.server.portint80The port on which the HHVM server will listen for requests.
hhvm.server.default_documentstring"index.php"The default document that will be served if a page is not explicitly specified.
hhvm.server.error_document404string"index.php"The default 404 error document that will be served when a 404 error occurs.
hhvm.server.userstring``The user to run the HHVM server under. Otherwise, the current user is used.

PHP 7 Settings

For changes from PHP 5 to PHP 7 which are backwards incompatible, INI options are available to choose which behavior HHVM respects. (Features which are not backwards incompatible are always available.)

The vast majority of users will want to just set hhvm.php7.all = 1 to fully enable PHP 7 mode and can ignore the rest of the options in this section. They are available primarily for advanced users who want to do a more gradual migration or otherwise track down compatibility issues.

SettingTypeDefaultDescriptionPHP 7 RFC
hhvm.php7.allboolfalseDefault value for all of the belowN/A
hhvm.php7.deprecate_old_style_ctorsboolhhvm.php7.allDisallow and warn when using old PHP 4 constructorsRemove PHP 4 constructors
hhvm.php7.engine_exceptionsboolhhvm.php7.allEnable throwing the new Error hierarchy of exceptionsEngine exceptions
hhvm.php7.int_semanticsboolhhvm.php7.allChange some edge-case int and float behavior, such as divide/mod by zeroInteger semantics with some changes due to engine exceptions
hhvm.php7.ltr_assignboolhhvm.php7.allMake order of assignment in list() lvalues consistentAbstract syntax tree
hhvm.php7.no_hex_numericsboolhhvm.php7.allDon't consider hex strings to be numericRemove hex support in numeric strings
hhvm.php7.scalar_typesboolhhvm.php7.allEnable PHP 7-style scalar type annotations (NB: not the same as Hack's)Scalar type declarations
hhvm.php7.uvsboolhhvm.php7.allFix some odd precedence and order of evaluation issuesUniform variable syntax

Server Mode

These are settings that are available to you when running HHVM in server mode. In normal, everyday usage, you will not use many of these settings. They are described here for completeness, and in case you might ever need them.

SettingTypeDefaultDescription
hhvm.env_variablesMapemptySet the contents of the $_ENV variable. You set them in the form of hhvm.env_variables[X]=Y. If you are setting just one, command line -d is fine. Otherwise, for multiple settings, use a .ini file.
hhvm.http.default_timeoutint30HTTP default timeout, in seconds.
hhvm.http.slow_query_thresholdint5000If a query takes longer than this setting, it is logged as a slow query.
hhvm.php_file.extensionsMap<string>emptyNormally, .php and .hh are treated as source code. With this setting you can add other file extensions to be treated as source code. You set them in the form of hhvm.php_file.extensions["pp"]=".pp". If you are setting just one, command line -d is fine. Otherwise, for multiple settings, use a .ini file.
hhvm.pid_filestringwww.pidThe location of the server process id file.
hhvm.ip_block_mapObjectemptyA set of IP information that will be blocked or allowed per endpoint. The format for this setting is below. You need a location and at least one allow or deny. This setting is currently not retrievable via ini_get(). This is not normally set.
hhvm.satellitesObjectemptyIf you have various ports for different types of servers, such as an RPC server. The format for this setting is below. You need at least a type and a port. This setting is currently not retrievable via ini_get(). This is not normally set.
hhvm.server_variablesMap<string>emptySet the contents of the $_SERVER variable. You set them in the form of hhvm.server_variables[X]=Y. If you are setting just one, command line -d is fine. Otherwise, for multiple settings, use a .ini file.
hhvm.server.allow_duplicate_cookiesbool!hhvm.force_hhIf enabled, this allows duplicate cookies for a name-domain-path triplet.
hhvm.server.allowed_exec_cmdsVector<string>emptyA whitelist of acceptable process commands for something like pcntl_exec. This setting is only effective if hhvm.server.whitelist_exec is true. You set them in the form of hhvm.server.allowed_exec_cmds[]="cmd". If you are setting just one, command line -d is fine. Otherwise, for multiple settings, use a .ini file.
hhvm.server.always_populate_raw_post_databoolfalseGenerally, if the content type is multipart/form-data, $HTTP_RAW_POST_DATA should not always be available. If this is enabled, then that data will always be available.
hhvm.server.always_use_relative_pathboolfalseIf enabled, files will be looked up and invoked via a relative path. In sandbox mode, files always use a relative path.
hhvm.server.backlogint128The maximum queue length for incoming connections.
hhvm.server.connection_limitint0The maximum number of connections the server (e.g., Proxygen) can accept. The default is 0, which is unlimited.
hhvm.server.connection_timeout_secondsint-1The maximum number of seconds a connection is allowed to stand idle after its previous read or write. If -1, this defaults to the server default (e.g., for Proxygen](/hhvm/basic-usage/proxygen) this is 50 seconds).
hhvm.server.dangling_waitint0The number of seconds to wait for a dangling server to respond. A dangling server allows the possibility for an older version of a server to run on a different port in case a page needs to be served from that old version.
hhvm.server.default_charset_namestring''This is used for PHP responses in case no other charset has been set explicitly. "UTF-8" is an example of a possible setting.
hhvm.server.default_documentstring"index.php"The default document that will be served if a page is not explicitly specified.
hhvm.server.default_server_name_suffixstring''If a server name is not specified for a virtual host, then the virtual prefix is prepended to this setting to create a server name.
hhvm.server.enable_early_flushbooltrueAllows chunked encoding responses.
hhvm.server.enable_keep_alivebooltrueIf enabled, the server will remain open for connection until hhvm.server.connection_timeout_seconds timeout.
hhvm.server.enable_on_demand_uncompressbooltrueIf enabled, this allows on-demand uncompress when reading from the file cache to avoid storing the uncompressed contents for compressible files.
hhvm.server.enable_output_bufferingboolfalseTurn output buffering on. While output buffering is active no output is sent from the script (other than headers), instead the output is stored in an internal buffer.
hhvm.server.enable_sslboolfalseIf enabled, HHVM will allow SSL connections to come through. Related to hhvm.server.ssl_port, hhvm.server.ssl_certificate_file, hhvm.server.ssl_certificate_key_file, hhvm.server.ssl_certificate_dir.
hhvm.server.enable_static_content_from_diskbooltrueA static content cache creates one single file from all static contents, including css, js, html, images and any other non-PHP files. Normally this is prepared by the compiler at compilation time, but it can also be prepared at run-time, if hhvm.server.source_root points to real file directory and this setting is true. Otherwise, use hhvm.server.file_cache to point to the static content cache file created by the compiler.
hhvm.server.enable_static_content_m_mapbooltrueThis setting being true overrides whatever is set for hhvm.server.enable_on_demand_uncompress.
hhvm.server.error_document404string''The default 404 error document that will be served when a 404 error occurs.
hhvm.server.error_document500string''The default 500 error document that will be served when a 500 error occurs.
hhvm.server.evil_shutdownbooltrueKill anything listening on the server port. This is enabled by default. When stopping a server, HHVM first tries to gracefully shut it down. If that doesn't work, and hhvm.server.harsh_shutdown is enabled, it will try to kill the pid file. If that doesn't work, then hhvm.server.evil_shutdown is invoked.
hhvm.server.exit_on_bind_failboolfalseIf the HHVM server cannot start because there is an older HHVM server running, if this flag is enabled, then the current HHVM just quits trying to start the server. If this is not enabled, HHVM try harsher measures to stop the older server so the current one can start up again.
hhvm.server.expires_activebooltrueIf enabled, then cached static content will expire after the duration of hhvm.server.expires_default.
hhvm.server.expires_defaultint2592000If hhvm.server.expires_active is enabled, then cached static content will expire after this amount of time. The default is 2592000 seconds (or 30 days).
hhvm.server.expose_hphpbooltrueExpose the X-Powered-By HHVM version header.
hhvm.server.expose_xfb_debugboolfalseIf enabled, Facebook specific debugging information is exposed.
hhvm.server.expose_xfb_serverboolfalseFacebook specific debugging information is exposed.
hhvm.server.fatal_error_messagestring''If this string is not empty, then when you encounter a 500, the message associated with the string is shown.
hhvm.server.file_cachestring''An absolute path to where the static content (e.g., css, html, etc.) created during compilation should be loaded. hhvm.server.enable_static_content_from_disk needs to be enabled for this setting to take effect.
hhvm.server.file_socketstring''If this string is not empty, then a file socket is used instead of an IP address for the server.
hhvm.server.fix_path_infoboolfalseIf enabled, this changes fastcgi path from SCRIPT_FILENAME to PATH_TRANSLATED.
hhvm.server.forbidden_as404boolfalseIf the extension of a URI is in the ``hhvm.server.forbidden_file_extensions` map, and this option is enabled, then that extension cannot be used as a 404 option either.
hhvm.server.forbidden_file_extensionsSet<string>emptyMap of filename extensions that will not be loaded by the server. You set them in the form of hhvm.server.forbidden_file_extensions[]=".exe". If you are setting just one, command line -d is fine. Otherwise, for multiple settings, use a .ini file.
hhvm.server.force_chunked_encodingboolfalseIf enabled, the server will only send chunked encoding responses for uncompressed payloads.
hhvm.server.force_compression.cookiestring''For compression, if this string is set and the cookie is present in the request, then compression should happen.
hhvm.server.force_compression.paramstring''For compression, if this string is set and the parameter is present in the request, then compression should happen.
hhvm.server.force_compression.urlstring''For compression, if this URL is set and the request matches exactly, then compression has to happen.
hhvm.server.force_server_name_to_headerboolfalseIf enabled, then $_SERVER['SERVER_NAME'] must come from the request header.
hhvm.server.global_documentstring''If specified, the document that handles every URI.
hhvm.server.graceful_shutdown_waitint0The amount of time to wait for a graceful shutdown of a server. If it doesn't shutdown during that period of time, then hhvm.server.harsh_shutdown may be invoked.
hhvm.server.gzip_compression_levelint3When compression with gzip, this is the level of compression that will be used. 1 is fastest. 9 is best.
hhvm.server.harsh_shutdownbooltrueWhen stopping a server, HHVM first tries to gracefully shutdown any previous incarnation of the server. If that doesn't work, and hhvm.server.harsh_shutdown is enabled, it will try to kill the pid file associated with the server process.
hhvm.server.high_priority_end_pointsSet<string>emptyA list of http endpoints that will be given request priority. The form is /endpoint.
hhvm.server.hoststring''The default host for the server.
hhvm.server.http_safe_modeboolfalseIf enabled, then you cannot open an HTTP stream.
hhvm.server.image_memory_max_bytesint0The maximum memory size for image process. If 0, then it will be set to hhvm.server.upload.upload_max_file_size * 2.
hhvm.server.implicit_flushboolfalseIf set to true, then the output buffer will be set to implicitly flush when executing requests.
hhvm.server.ipstring''The default ip address for the server.
hhvm.server.kill_on_sigtermboolfalseIf enabled, and the server receives a SIGTERM signal, then server will be stopped.
hhvm.server.light_process_countint0The number of light processes to turn on. Light processes have very little forking cost because they are pre-forked. They can provide for faster shell command execution.
hhvm.server.light_process_file_prefixstring./lightprocessThe file prefix for a light process.
hhvm.server.lock_code_memoryboolfalseUnless this is enabled, during paging the server into memory, the binary is munlock()ed.
hhvm.server.max_array_chainintINT_MAXFor balancing arrays. Normally this is best left as the default.
hhvm.server.max_post_sizeint100The maximum POST content-length. This is 100 MB.
hhvm.server.memory_head_roomint0How much memory headroom is allowed. If kept at the default, then the active memory limit is std::numeric_limits<size_t>::max().
hhvm.server.output_handlerstring''A custom output buffer handler. If left empty, then the default is used.
hhvm.server.path_debugboolfalseIf a 404 is returned, and this is enabled, then the URL paths examined will be displayed.
hhvm.server.portint80The port on which the HHVM server will listen for requests.
hhvm.server.psp_cpu_timeout_secondsint0The length of CPU time a post-send processing request (PSP) is allocated. If 0, the timer is reset to the last one. If negative, the timeout is set to that value if there is less than that value remaining. If positive, the timeout is set to that value.
hhvm.server.psp_timeout_secondsint0The length of time a post-send processing request (PSP) is allocated. If 0, the timer is reset to the last one. If negative, the timeout is set to that value if there is less than that value remaining. If positive, the timeout is set to that value.
hhvm.server.request_body_read_limitint-1Only valid for a proxygen server, if set to something other than -1, a limit is set on the request buffer and new data won't be added to the buffer until that part of the request is processed.
hhvm.server.request_init_documentstring''The document that is loaded and executed upon the server receiving a request.
hhvm.server.request_init_functionstring''The function that is executed upon the server receiving a request. If both hhvm.server.request_init_function and this is specified, the former is executed first.
hhvm.server.request_memory_max_bytesint0The maximum number of bytes for a request. If not explicitly set (i.e., remains the default of 0), this value is set to 16GB or the system's memory limit, which ever is less.
hhvm.server.request_timeout_secondsint0The amount of time provided for a request to process before the server times out. If 0 (default), there is no explicit request timeout.
hhvm.server.safe_file_accessboolfalseIf enabled, then when a file is accessed it ensures that the file is in an allowed directory, is not an absolute path, and is resolvable.
hhvm.server.shutdown_listen_waitint0When the proxygen server is stopped, if this value is set to something positive, then it will continue to listen that number of seconds before actually shutting down.
hhvm.server.ssl_certificate_dirstring''The directory where your SSL certificate information is located. hhvm.server.enable_ssl must be enabled for this to take effect.
hhvm.server.ssl_certificate_filestring''The file that contains your SSL certificate. hhvm.server.enable_ssl must be enabled for this to take effect.
hhvm.server.ssl_certificate_key_filestring''The file that contains your SSL certificate key. hhvm.server.enable_ssl must be enabled for this to take effect.
hhvm.server.ssl_portint443The port for SSL connections. hhvm.server.enable_ssl must be enabled for this to take effect.
hhvm.server.stat_cacheboolfalseIf enabled, the server will cache calls to stat().
hhvm.server.takeover_filenamestring''Between server instances port takeover, this is the file that is used.
hhvm.server.thread_countint2x the number of CPU coresThis specifies the number of worker threads used to serve web traffic in server mode. The number to set here is really quite experimental. If you use async, then this number can be the default. Otherwise, you might want a higher number.
hhvm.server.thread_drop_cache_timeout_secondsint0The amount of time for a server thread to drop its cache.
hhvm.server.thread_drop_stackboolfalseIf we have timed out via hhvm.server.thread_drop_cache_timeout_seconds, if this is enabled, then we also flush the thread stack itself.
hhvm.server.thread_job_lifo_switch_thresholdintINT_MAXAn option where the request processing order can flip between FIFO or LIFO based on the length of the queue. If the job queue is configured to be in FIFO mode, and the current queue length exceeds lifoSwitchThreshold, then the workers will begin work on requests in LIFO order until the queue size is below the threshold in which case we resume in FIFO order.
hhvm.server.thread_job_max_queuing_milli_secondsint-1If set to a positive number, this will be the number of milliseconds that will be waited for a job before it expires.
hhvm.server.thread_round_robinboolfalseBy default, the last thread serves next. If this setting is enabled, then serving is done round robin style.
hhvm.server.tls_client_cipher_specstring''If not empty, then the SSL ciphers are set with the control string provided.
hhvm.server.tls_disable_tls1_2boolfalseIf enabled, then the TLSv1.2 protocol is disabled.
hhvm.server.typestring"proxygen"The type of server you want to serve up requests for the HHVM server. The default is "proxygen", but you can also specify "fastcgi".
hhvm.server.unserialization_whitelist_checkboolfalseIf enabled, only classes in the whitelist passed as the second argument to the unserialize() method will be allowed to be unserialized.
hhvm.server.unserialization_whitelist_check_warning_onlybooltrueIf hhvm.server.unserialization_whitelist_check is enabled, then if a class is attempted to be unserialized that is not in the whitelist, and this is enabled, only a warning will be displayed instead of erroring.
hhvm.server.upload.enable_file_uploadsbooltrueAllow files to be uploaded.
hhvm.server.upload.enable_upload_progressboolfalseIf enabled, then a file upload progress bar can be displayed. For example, the client can then query the apc user cache to find out the upload progress and then display an upload progress bar.
hhvm.server.upload.rfc1867freqint256 * 1024 (256K)If hhvm.server.upload.enable_upload_progress is enabled, then this is how often the progress will be updated.
hhvm.server.upload.rfc1867namestringvideo_ptokenThe hidden form entry name that activates APC upload progress and specifies the user cache key suffix.
hhvm.server.upload.rfc1867prefixstringvupload_Key prefix for the user cache entry generated by rfc1867 upload progress functionality.
hhvm.server.upload.upload_max_file_sizeint100 (MB)The maximum file upload size.
hhvm.server.upload.upload_tmp_dirstring'/tmp'The temporary directory used for file uploads.
hhvm.server.use_direct_copyboolfalseIf enabled, files will be renamed using very little disk-cache.
hhvm.server.userstring``The user to run the HHVM server under. Otherwise, the current user is used.
hhvm.server.utf8ize_replacebooltrueWhether to convert and replace all characters with UTF8.
hhvm.server.warmup_throttle_request_countint0If positive, and if hhvm.server.thread_count is greater than the number of processors, then the starting number of warmup threads will be the same as hhvm.server.thread_count - (the number of processors).
hhvm.server.warn_on_collection_to_arrayboolfalseIf enabled, every time you try to convert a collection to an array, you will get a warning explaining that the operation is expensive and should be avoided.
hhvm.server.whitelist_execboolfalseIf enabled, then this sets a whitelist of commands that will be executed, given by hhvm.server.allowed_exec_cmds.
hhvm.server.whitelist_exec_warning_onlyboolfalseIf enabled, and hhvm.server.whitelist_exec is enabled, if you try to execute a command outside the whitelist, you will only get a warning.
hhvm.server.xfb_debug_ssl_keystringboolIf hhvm.expose_xfb_debug or hhvm.expose_xfb_server is enabled, this will be the SSL key that will be used.
hhvm.static_file.extensionsMap<string>(see description)Map of filename extensions to content types for use by the proxygen server. The defaults are below. You set them in the form of hhvm.static_file.extensions[]=Y. If you are setting just one, command line -d is fine. Otherwise, for multiple settings, use a .ini file.
hhvm.static_file.files_matchVector<string>emptyA list of file extensions that will have http transport headers added to them. The format of this setting is below. You need a pattern and at least one header. This setting is currently not retrievable via ini_get(). This is not normally set.
hhvm.static_file.generatorsSet<string>emptyDynamic files that serve up static content. This is not normally set. You set them in the form of hhvm.static_file.generators[]="/path/to". If you are setting just one, command line -d is fine. Otherwise, for multiple settings, use a .ini file.
hhvm.tiersObjectemptyCOMING SOON to ini. Allows you to override settings based on various tier settings like CPU, machine name, etc.
hhvm.virtual_hostObjectemptyYou can map server domains as various virtual hosts with a lot of settings described below. You need at least a prefix or a pattern. This setting is currently not retrievable via ini_get().

Static File Extension Defaults

These are the default file extensions for hhvm.static_file.extensions:

array(11) {
["zip"]=>
string(15) "application/zip"
["jpeg"]=>
string(10) "image/jpeg"
["html"]=>
string(9) "text/html"
["css"]=>
string(8) "text/css"
["gif"]=>
string(9) "image/gif"
["mp3"]=>
string(10) "audio/mpeg"
["png"]=>
string(9) "image/png"
["tif"]=>
string(10) "image/tiff"
["jpg"]=>
string(10) "image/jpeg"
["tiff"]=>
string(10) "image/tiff"
["txt"]=>
string(10) "text/plain"
}

Static File Files Match Format

This the ini format for hhvm.static_file.files_match:

hhvm.static_file.files_match[0][pattern]   = "[regex](here)*"
hhvm.static_file.files_match[0][headers][] = "header1"
hhvm.static_file.files_match[0][headers][] = "header2"

IP Block Map Format

This is an example of the ini format for hhvm.ip_block_map.

hhvm.ip_block_map[0][location]     = /endpoint
hhvm.ip_block_map[0][allow_first] = true
hhvm.ip_block_map[0][ip][allow][0] = 127.0.0.1
hhvm.ip_block_map[0][ip][deny][0] = 8.32.0.0/24
hhvm.ip_block_map[0][ip][deny][1] = aaaa:bbbb:cccc:dddd:eeee:ffff:1111::/80

allow_first basically says whether you allow an ip by default or not. You can then have other endpoints with [1], [2], etc.

Satellite Format

The options you can give for hhvm.satellites are:

Satellites {
NAME {
Type = RPCServer | InternalPageServer | DanglingPageServer

Port = 0 # disabled
ThreadCount = 5

# only for RPCServer
MaxRequest = 500
MaxDuration = 120 # in seconds
TimeoutSeconds = 30 # default to RequestTimeoutSeconds
RequestInitFunction = on_init
RequestInitDocument = filename
Password = authentication
Passwords {
* = password
}
# only for InternalPageServer
BlockMainServer = true
URLs {
* = pattern
}
}
}

This is an example of the ini format for hhvm.satellites.

hhvm.satellites[rpc][type] = RPCServer
hhvm.satellites[rpc][port] = 9999
hhvm.satellites[rpc][request_init_document] = my/rpc/rpc.php
hhvm.satellites[rpc][request_init_function] = init_me
hhvm.satellites[rpc][password] = abcd0987
hhvm.satellites[rpc][passwords][] = abcd0987
hhvm.satellites[ips][type] = InternalPageServer
hhvm.satellites[ips][block_main_server] = false
hhvm.satellites[ips][urls][] = url/here

Virtual Host Format

The options you can give to hhvm.virtual_host are:

VirtualHost {
NAME {
Disabled = false
Prefix = prefix.
Pattern = regex pattern
PathTranslation = html
CheckExistenceBeforeRewrite = true
ServerName =
ServerVariables {
name = value
}
Overwrite = {
[default][setting] = new 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)
}
}
}
}

This is an example of the ini format for hhvm.virtual_hosts:

hhvm.server.allowed_directories[] = /var/www
hhvm.server.allowed_directories[] = /usr/bin
hhvm.virtual_host[flibtest][prefix] = my.
hhvm.virtual_host[flibtest][path_translation] = flib/_bin
hhvm.virtual_host[flibtest][server_name] = my.example.org
hhvm.virtual_host[flibtest][log_filters][0][url] = function/searchme
hhvm.virtual_host[flibtest][log_filters][0][params][0] = v
hhvm.virtual_host[flibtest][log_filters][0][params][1] = t
hhvm.virtual_host[flibtest][log_filters][0][params][2] = btoken
hhvm.virtual_host[flibtest][log_filters][0][params][3] = ptoken
hhvm.virtual_host[flibtest][log_filters][0][value] = INSERTED
hhvm.virtual_host[flibtest][log_filters][1][url] = property/searchme
hhvm.virtual_host[flibtest][log_filters][1][pattern] = #thePattern#
hhvm.virtual_host[flibtest][log_filters][1][value] = BETWEEN
hhvm.virtual_host[upload][prefix] = upload.
hhvm.virtual_host[upload][server_variables][TFBENV] = 8
hhvm.virtual_host[upload][overwrite][server][allowed_directories][0] = /var/www
hhvm.virtual_host[upload][overwrite][server][allowed_directories][1] = /mnt
hhvm.virtual_host[upload][overwrite][server][allowed_directories][2] = /tmp
hhvm.virtual_host[upload][overwrite][server][allowed_directories][3] = /var/tmp/tap
hhvm.virtual_host[upload][overwrite][server][max_post_size] = 100MB
hhvm.virtual_host[upload][overwrite][server][upload][upload_max_file_size] = 100MB
hhvm.virtual_host[upload][overwrite][server][request_timeout_seconds] = 120
hhvm.virtual_host[upload][path_translation] = html
hhvm.virtual_host[default][path_translation] = htm
hhvm.virtual_host[default][log_filters][0][url] = method/searchme
hhvm.virtual_host[default][log_filters][0][params][0] = q
hhvm.virtual_host[default][log_filters][0][params][1] = s
hhvm.virtual_host[default][log_filters][0][params][2] = atoken
hhvm.virtual_host[default][log_filters][0][params][3] = otoken
hhvm.virtual_host[default][log_filters][0][value] = REMOVED
hhvm.virtual_host[default][rewrite_rules][common][pattern] = /html/common/
hhvm.virtual_host[default][rewrite_rules][common][to] = http://example.org
hhvm.virtual_host[default][rewrite_rules][common][qsa] = true
hhvm.virtual_host[default][rewrite_rules][common][redirect] = 301

Feature flags

These settings enable various features in the runtime, including Hack-specific features.

SettingTypeDefaultDescription
hhvm.enable_obj_destruct_callboolfalseIf false, __destruct() methods will not be called on an object at the end of the request. This can be a performance benefit if your system and application can handle the memory requirements. Deallocation can occur all at one time. If true, then HHVM will run all __destruct() methods in the usual way.
hhvm.force_hhboolfalseIf true, all code is treated as Hack code, even if it starts with <?php. This setting affects hhvm.enable_xhp by forcing it to be true as well. This setting affects hhvm.hack.lang.ints_overflows_to_ints and hhvm.log.always_log_unhandled_exceptions by being the default value for them when they are not explicitly set. This setting affects hhvm.hack.lang.look_for_typechecker and hhvm.server.allow_duplicate_cookies by being the opposite value for a default when they are not explicitly set.
hhvm.hack.lang.ints_overflow_to_intsboolValue of hhvm.force_hhValue of hhvm.force_hh
hhvm.hack.lang.look_for_typecheckerboolOpposite value of hhvm.force_hhIf enabled, make sure that Hack code is under a directory with a .hhconfig file, and error otherwise.
hhvm.enable_args_in_backtracesbooltrueIf disabled, then arguments are not shown in PHP backtraces.
hhvm.enable_asp_tagsboolfalseIf enabled, then you can use <% %>.
hhvm.enable_hip_hop_experimental_syntaxboolfalseEnables experimental syntax, including type hints for local variables and global variables.
hhvm.enable_numaboolfalseEnable NUMA integration.
hhvm.enable_numa_localboolfalseThis causes all allocations from threads to be allocated on the local node (except for a few that have been explicitly marked interleaved). hhvm.enable_numa must be set to true for this to take affect.
hhvm.enable_short_tagsboolfalseIf enabled, this allows the <? tag.
hhvm.enable_xhpboolfalseIf true, this will enable XHP support in PHP files. (XHP is always enabled in Hack files.) If hhvm.force_hh is set to true, then this setting is automatically true.
hhvm.enable_zend_compatboolfalseIf true, this enable the support layer for Zend PHP extensions that we have directly migrated to HHVM (e.g. FTP).
hhvm.authoritative_modeboolfalseIf enabled, HHVM disallows constructs that are unavailable in Repo Authoritative mode even when you are not in Repo Authoritative mode (i.e., when hhvm.repo.authoritative is false).

Logging

SettingTypeDefaultDescription
hhvm.log.access_log_default_formatstring%h %l %u %t \"%r\" %>s %bThe access log format. if not specified, the default uses Apache access log formatting.
hhvm.log.admin_log.filestring''For the admin server, this will be the location and name for its log file.
hhvm.log.admin_log.formatstring%h %t %s %UThe admin access log format.
hhvm.log.admin_log.sym_linkstring''You can provide a symlink to the hhvm.log.admin_log.file.
hhvm.log.always_escape_logbooltrueBy default, escape characters in the logs are escaped. Disable this to not escape them.
hhvm.log.always_log_unhandled_exceptionsboolhhvm.force_hhUnhandled exceptions are HHVM fatal errors, and AlwaysLogUnhandledExceptions will make sure they get logged even if a user's error handler is installed for them. The default value is equivalent to what you set for hhvm.force_hh.
hhvm.log.drop_cache_chunk_sizeint1 << 20 (1 MB)When dropping the cache, logging will happen after this many bytes have been written.
hhvm.log.filestringstandard error (stderr)The location of the HHVM error log file. If hhvm.log.use_cronolog is set, then this setting will be used as the cron output file.
hhvm.log.force_error_reporting_levelint0A bitmask that will be ORed (`
hhvm.log.headerboolfalseIf enabled, the request header is logged. Header includes timestamp, process id, 34 thread id, request id (counted from 1 since the server started), message id (counted from 1 since request started) and extra header text from command line option.
hhvm.log.header_mangleint0This setting controls the logging of potentially malicious headers. If set to a value greater than 0, then HHVM will log one in every n (where n is the value of the setting) requests where a header collision has occurred. Such collisions almost certainly indicate a malicious attempt to set headers which are either set or filtered by a proxy.
hhvm.log.levelstringWarningThe level of output to the log. From least to most verbose: None, Error, Warning, Info, Verbose.
hhvm.log.max_messages_per_requestint-1Controls maximum number of messages each request can log. If positive, then that number will be the threshold. Otherwise, unlimited messages per request can be logged.
hhvm.log.native_stack_tracebooltrueTurn off to disable the logging of the native stack trace. 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.
hhvm.log.no_silencerboolfalseIf enabled, even when silencer (@) operator is used, still output errors.
hhvm.log.runtime_error_reporting_levelintHPHP_ALLA numeric setting similar to error_reporting in PHP. See below for the possible settings.
hhvm.log.sym_linkstring''You can provide a symlink to the hhvm.log.file. If hhvm.log.use_cronolog is set, then this setting will be used to create a symlink to the cron output file.
hhvm.log.use_cronologboolfalseIf enabled, this will switch to a rotating log paradigm via cronolog.
hhvm.log.use_log_filebooltrueThe default logging mechanism via the log file specified by hhvm.log.file.
hhvm.log.use_request_logboolfalseIf enabled, requests are logged into a special file where the root of that file is specified hhvm.sandbox.logs_root.
hhvm.log.use_syslogboolfalseAlso log to the system log (syslog).
hhvm.log.accessMap<string>emptyThe location and format of explicit access logs. You set them in the form of hhvm.log.access["file"]="format". If you are setting just one, command line -d is fine. Otherwise, for multiple settings, use a .ini file. This setting is currently not retrievable via ini_get()

Error Reporting Levels

Here are the error reporting levels you can provide to hhvm.log.runtime_error_reporting_level.

ERROR = 1,
WARNING = 2,
PARSE = 4, // not supported
NOTICE = 8,
CORE_ERROR = 16, // not supported
CORE_WARNING = 32, // not supported
COMPILE_ERROR = 64, // not supported
COMPILE_WARNING = 128, // not supported
USER_ERROR = 256,
USER_WARNING = 512,
USER_NOTICE = 1024,
STRICT = 2048,
RECOVERABLE_ERROR = 4096,
PHP_DEPRECATED = 8192, // DEPRECATED conflicts with macro definitions
USER_DEPRECATED = 16384,

/*
* PHP's fatal errors cannot be fed into error handler. HipHop can. We
* still need "ERROR" bit, so old PHP error handler can see this error.
* The extra 24th bit will help people who want to find out if it's
* a fatal error only HipHop throws or not.
*/
FATAL_ERROR = ERROR | (1 << 24), // 16777217

PHP_ALL = ERROR | WARNING | PARSE | NOTICE | CORE_ERROR | CORE_WARNING |
COMPILE_ERROR | COMPILE_WARNING | USER_ERROR | USER_WARNING |
USER_NOTICE | RECOVERABLE_ERROR | PHP_DEPRECATED | USER_DEPRECATED,

HPHP_ALL = PHP_ALL | FATAL_ERROR,

/* Errors that can be upgraded to E_USER_ERROR. */
UPGRADEABLE_ERROR = WARNING | USER_WARNING | NOTICE | USER_NOTICE

Admin Server

The admin server allows the administrator of the HHVM server to query and control the HHVM server process.

SettingTypeDefaultDescription
hhvm.admin_server.passwordstring''A password required for all requests to the admin server, other than the index. Is passed to the request as the auth request var.
hhvm.admin_server.portint0The port the admin server should listen on. If set to 0, the admin server is not started.
hhvm.admin_server.thread_countint1The number of threads the admin server should use.

CLI Server

The CLI server allows you to run command line scripts on a running HHVM server. This means the translation cache can persist between runs of your scripts.

SettingTypeDefaultDescription
hhvm.use_remote_unix_serverstringnoEnable the use of the CLI server.
hhvm.unix_server_pathstring''The path to the unix socket for the CLI server.
hhvm.unix_server_workersintCPU coresThe number of worker threads the CLI server will allow.
hhvm.unix_server_quarantine_apcboolfalseQuarantine APC from the scripts being run.
hhvm.unix_server_quarantine_unitsboolfalseQuarantine the loaded units from the scripts being run on a per user bases.
hhvm.unix_server_verify_exe_accessboolfalseChecks units are readable by client before executing them on the server.
hhvm.unix_server_fail_when_busyboolfalseFail if there are no available workers.
hhvm.unix_server_allowed_usersVector<string>emptyUsers allowed to use the CLI server.
hhvm.unix_server_allowed_groupsVector<string>emptyGroups allowed to use the CLI server.

Debug Settings

These settings are useful when you are debugging actual HHVM issues.

SettingTypeDefaultDescription
hhvm.debug.clear_input_on_successbooltrueAutomatically delete requests that had a 200 response code when recording input. This allows for the capturing of error-prone requests without cluttering up with good ones.
hhvm.debug.core_dump_emailstring''When HHVM produces a core dump, if this is set to an email address, then an email will be sent with the core dump information.
hhvm.debug.core_dump_reportbooltrueIf enabled, HHVM will generate a core dump report as necessary.
hhvm.debug.core_dump_report_directorystring/tmpWhen a core dump is produced, it will be put in this directory.
hhvm.debug.native_stack_traceboolfalseIf enabled, a native static trace will be produced.
hhvm.debug.profiler_output_dirstring/tmpBuilding with GOOGLE_CPU_PROFILER set lets you collect profiles from the server or from the command line. This option lets you control where the profiles get created.
hhvm.debug.record_inputboolfalseIf enabled, record bad HTTP requests to a file /tmp/hphp_request_XXXXXX.
hhvm.debug.server_error_messageboolfalseIf enabled, turn on error messages in HTTP responses with detailed stacktrace information. Send the error message to the output stream - corresponds to display_errors in PHP.
hhvm.debug.simple_counter.sample_stack_countint0HHVM has an implementation of a set of request-local named counters. This setting controls how many samples of the named counter should there be.
hhvm.debug.simple_counter.sample_stack_depthint5For each sample stack from hhvm.debug.simple_counter.sample_stack_count, this controls the depth of each sample.
hhvm.dump_astboolfalseIf enabled, the AST will be dumped to stdout.
hhvm.dump_bytecodeint0If positive, before executing a PHP file, dump out its HHBC along with some interesting metadata, then continue executing the file. If 1 then the user PHP bytecode is dumpted. If 2 then user PHP and System library information is dumped. Useful only for debugging.
hhvm.dump_hhasboolfalseIf enabled, instead of executing a PHP file, dump out an hhas (HHVM Assembly) file and exit. Useful for debugging, or if you need to directly write some hhas and need an easy way to get started.
hhvm.dump_ring_buffer_on_crashint0If positive, then when HHVM crashes, the ring buffer will be dumped.
hhvm.dump_tcboolfalseIf enabled, dump contents of translation cache when executing program from the command line.
hhvm.dump_tc_anchorsboolfalseIf enabled, dump the translation cache anchors.
hhvm.keep_perf_pid_mapboolfalseIf enabled, don't delete the perf pid map.
hhvm.perf_data_mapboolfalseIf enabled, generate a perf data map.
hhvm.perf_pid_mapbooltrueIf enabled, generate a perf pid map.

Sandbox

A sandbox in HHVM is a set of configuration options (document root, log file path, etc.) that can be used to serve your web application.

Here are a few important points:

  • The sandbox configuration file must end in .hdf or .hphp. Most people name it .hphp.
  • Having a configuration file end in .ini is currently broken, but a fix is being worked on now. When HDF is removed in favor of INI, this will be fixed.
  • A user is always appended to hhvm.sandbox.home. So if you set that setting to /home, it will end up being /home/user. Thus the hhvm.sandbox.conf_file will end up having an absolute path of /home/user/.hphp.
  • The sandbox pattern assumes that you have valid URLs that can be associated with that pattern. You would need to have those URLs bound in something like /etc/hosts (e.g., 127.0.0.1 user-another_site.localhost.com).
  • If you do not specify a sandbox name in the URL, it assumes the default sandbox. e.g., if you type or curl user.localhost.com, that will assume your default sandbox.
  • If you enable hhvm.sandbox.from_common_root, make sure you have running code available from that root, or that root prepended by the value of hhvm.sandbox.directories_root, if you have that set as well.
  • If you are using the HHVM builtin webserver proxygen, as long as you are running the server from a location where there is access to your sandbox (e.g., the root of a sandbox directory), all of your sandboxes URLs should be available to you for testing.

Below is a general configuration setup for a sandbox that you can use as a template.

ini file

user-another_site.localhost.com would fit the hhvm.sandbox.pattern pattern.

hhvm.sandbox.sandbox_mode = 1
hhvm.sandbox.home=/home
hhvm.sandbox.conf_file=.hphp
hhvm.sandbox.pattern=([^-]*(-[^-]*)?).localhost.com

Sandbox configuration file ~/.hphp

If you have hhvm.sandbox.home set, default.xxx can be relative to that directory (remembering that a user is appended to what you set as hhvm.sandbox.home). For example, below, if we had hhvm.sandbox.home = /home, then we could set default.path to sites/www.

The default.ServerVars.ANY_SERVER_VARIABLE=1 is just an example.

default.path = /home/user/sites/www
default.log = /home/user/sites//error_log
default.accesslog = /home/user/logs/access_log
default.ServerVars.ANY_SERVER_VARIABLE=1

another_site.path = /home/user/sites/another-site
another_site.log = /home/user/sites/another-site/logs/error_log
another_site.accesslog = /home/user/sites/another-site/logs/access_log
SettingTypeDefaultDescription
hhvm.sandbox.sandbox_modeboolfalseIf enabled, sandbox mode is turned on; generally coincides with turning on HHVM server debugging.
hhvm.sandbox.homestring''The home directory of your sandbox. e.g., If this is set to /home, then your sandbox path will be something like /home/joelm/.
hhvm.sandbox.conf_filestring''The file which contains sandbox information like the path to the default sandbox, the path to other sandboxes, log paths, etc. You can use this file in conjunction with some of some of the other specific sandbox options. For example, if hhvm.sandbox.home is set, then this setting is relative to that path.
hhvm.sandbox.patternstring''The URL pattern of your sandbox host. It is a generally a regex pattern with at least one capture group. For example www.[user]-[sandbox].[machine].yourdomain.com or www.([^-]*(-[^-]*)?).yourdomain.com
hhvm.sandbox.from_common_rootboolfalseIf enabled, your sandboxes will be created from a common root path. This root path is based upon the hhvm.sandbox.pattern that you specify and the value of it will be the root string before the first . in the pattern. If you have a pattern like ([^-]*(-[^-]*)?).localhost.com which maps to a sandbox at user-another_site.localhost.com, the root that is established by enabling this setting is /joelm-another_site. This setting as true supersedes any setting you have for hhvm.sandbox.conf_file.
hhvm.sandbox.directories_rootstring''If you have hhvm.sandbox.from_common_root enabled, this value will be prepended to your common root.
hhvm.sandbox.logs_rootstring''If you have hhvm.sandbox.from_common_root enabled, this value will be prepended to your common root.
hhvm.sandbox.fallbackstring''If for some reason your home path in hhvm.sandbox.home cannot be accessed, this will be your fallback to set as your home path.
hhvm.sandbox.server_variablesmapemptyAny server variables that you want accessible when running your sandbox.

Debugger

A sandbox is commonly used in conjunction with debugging to debug HHVM in server mode. When you connect the debugger to a server mode process, you will be given the option of a sandbox on which to attach the debugger. The first option you will always see (and attach to by default) is the dummy sandbox, which has no document root. It is primarily used for real-time evaluation of code from the debugger prompt.

These options are used to allow you to use the hphpd debugger remotely via a sandbox. HHVM must be running in server mode, as there needs to be a server process on which to attach.

These are the common .ini file options to set to enable HHVM to start a debugger in server mode.

hhvm.sandbox.sandbox_mode=1
hhvm.sandbox.home=/home
hhvm.sandbox.conf_file=.hphp
hhvm.sandbox.pattern="([^-]*(-[^-]*)?)\.localhost\.com"
hhvm.debugger.enable_debugger = 1
hhvm.debugger.enable_debugger_server = 1
hhvm.debugger.default_sandbox_path = /path/to/your/sandbox

If you run your server as hhvm -m server -c this.ini and in another terminal, type hhvm -m debug -h localhost, you will see:

Welcome to HipHop Debugger!
Type "help" or "?" for a complete list of commands.

Connecting to localhost:8089...
Attaching to user's default sandbox and pre-loading, please wait...
localhost> m l
1 user's default sandbox at /home/user/sites/www/

To start debugging:

localhost> break start
break start
Breakpoint 1 set start of request
localhost> continue
continue

Then you can make a web request via your browser or curl to your sandbox URL. You can set breakpoints in your sandbox code to stop at certain places of execution as well.

If you want to debug another sandbox instead of the default, you can explicitly specify the sandbox:

hhvm -m debug -h localhost --debug-sandbox another_site
SettingTypeDefaultDescription
hhvm.debugger.enable_debuggerboolfalseYou must set this to try in order for HHVM to listen to connections from the debugger.
hhvm.debugger.enable_debugger_serverboolfalseThis option is generally set in conjunction with hhvm.debugger.enable_debugger and actually allows for the listening to connections and remote debugging.
hhvm.debugger.default_sandbox_pathstring''Path to source files; similar to hhvm.server.source_root.
hhvm.debugger.disable_ipv6boolfalseIf enabled, the debugger will only be able to communicate with ipv4 addresses (AF_INET).
hhvm.debugger.enable_debugger_colorbooltrueDisable this if you do not want color in the debugger.
hhvm.debugger.enable_debugger_promptbooltrueDisable this if you do not want a debugger prompt to be shown.
hhvm.debugger.enable_debugger_usage_logboolfalseCurrently this is only an internal setting.
hhvm.debugger.portint8089The port on which debugger clients may connect.
hhvm.debugger.rpc.default_authstring''The password to be able to debug the HHVM server in RPC mode.
hhvm.debugger.rpc.default_portint8083The port on which commands will be sent to the server via RPC.
hhvm.debugger.rpc.default_timeoutint30The timeout for commands to be available on the RPC port.
hhvm.debugger.rpc.host_domainstring''The domain where your RPC server is hosted.
hhvm.debugger.signal_timeoutint1The amount of time the debugger waits for a signal from the client before sending to a default dummy sandbox.
hhvm.debugger.startup_documentstring''The file that is executed before any other, when the server starts. Does not have to be the same your default document. Similar to hhvm.server.startup_document.
hhvm.bypass_access_checkboolfalseIf enabled, forces the debugger bypass access checks on class members.
hhvm.script_modeboolfalseIf enabled, then the debugger is debugging in script mode.
hhvm.tutorialboolfalseIf enabled, you can go through the debugger tutorial.
hhvm.tutorial.visitedboolfalseIf enabled, this will tell the debugger you have already seen the tutorial.
hhvm.print_levelint5The amount of printing you want in the debugger.
hhvm.source_rootstring''If explicitly set, then the debugger will look for source code there. Otherwise, it is where the debugger is running from.
hhvm.small_stepboolfalseIf enabled, small steps will be used instead of entire lines.
hhvm.stack_argsbooltrueIf disabled, then stack arguments will not be shown in the debugger.
hhvm.max_code_linesint-1If positive, then limit the code shown after a step to that number of code lines. If 0, then do not show any code after a step or next. If -1, then just show the default number of lines.
hhvm.utf8booltrueIf enabled, then use UTF8 by default.
hhvm.short_print_char_countint200Display at most count characters when doing = command.
hhvm.macrosMapemptyA custom list of macros that you want to be able to run in the debugger. You set them in the form of hhvm.macros[name][]="cmd1", hhvm.macros[name][]="cmd2", etc.. If you are setting just one, command line -d is fine. Otherwise, for multiple settings, use a .ini file.
hhvm.never_save_configboolfalseIf enabled, then your debugger configuration settings will not be saved.

Error Handling

These settings are used to help set or throttle certain errors/warnings/etc. that may arise in your PHP or Hack code.

SettingTypeDefaultDescription
hhvm.error_handling.call_user_handler_on_fatalsboolfalseCall a callback installed via set_error_handler() when a fatal error occurs.
hhvm.error_handling.max_serialized_string_sizethrow exception if unserializing a string greater than this amount64 * 1024 * 1024 (64 MB)
hhvm.error_handling.no_infinite_recursion_detectionboolfalseIf enabled, do not raise an error if infinite recursion is detected.
hhvm.error_handling.notice_frequencyint1Log every N notices, where N is this number. If the value is <=0, then no notices are logged.
hhvm.error_handling.throw_exception_on_bad_method_callbooltrueIf enabled, throw an error if calling a method on a non-object.
hhvm.error_handling.upgrade_levelint0Bitmask of errors to upgrade to E_USER_ERROR. Only E_WARNING, E_USER_WARNING, E_NOTICE, and E_USER_NOTICE are supported.
hhvm.error_handling.warning_frequencyint1Log every N warnings, where N is this number. If the value is <=0, then no warnings are logged.

XML

The following are settings that you can use for libxml or simplexml, as specified.

SettingTypeDefaultDescription
hhvm.libxml.ext_entity_whiteliststring'data'Loading of external entities in the libxml extension is disabled by default for security reasons. It can be re-enabled on a per-protocol basis with this setting. It is a comma separated list of protocols. The common ones are file, http, compress.zlib. An example of how the setting is set is: hhvm._libxml.ext_entity.whitelist=file,http. This setting is currently not retrievable via ini_get().
hhvm.simple_xml.empty_namespace_matches_allboolfalseIf enabled, an empty XML namespace matches all namespaces.

JIT Settings

These settings can allow fine-grain tuning of HHVM's JIT compiler.

The hacker's guide goes more in depth nin how the JIT works as well.

SettingTypeDefaultDescription
hhvm.jitbooltrueEnables the JIT compiler. This is turned on by default for all supported distributions. Times when you might want to turn this off is for a short running script that may not make use of the JIT.
hhvm.jit_always_interp_oneboolfalse
hhvm.jit_disabled_by_hphpdboolfalseIf enabled, the JIT is disabled in the debugger.
hhvm.jit_enable_rename_functionboolfalseIf false, fb_rename_function() will throw a fatal error. And HHVM knowing that functions cannot be renamed can increase performance.
hhvm.jit_global_translation_limitint-1How often the JIT does translation before falling back to interpreted code. The default is to always JIT.
hhvm.jit_max_request_translation_timeint-1Sets a maximum number of microseconds to spend per request translating. This is useful for deployments that can't rely on a warm-up script. Default is an unlimited amount of time. Requires hhvm.jit_timer to be enabled.
hhvm.jit_keep_dbg_filesboolfalseIf enabled, elf writer based debug files will be kept.
hhvm.jit_llvmint0If enabled, then use the experimental LLVM backend, see this blog post for more information. If 0, LLVM is not used. If 1, LLVM is used for TransOptimize translations. If 2, LLVM is used for all translations.
hhvm.jit_loopsbooltrueDisable this if you don't want loops to be compiled by the JIT, but rather interpreted.
hhvm.jit_max_translationsint12Limits the number of translations allowed per srckey, and once this limit is hit any further retranslation requests will result in a call out to the interpreter.
hhvm.jit_no_gdbbooltrueIf set to false, the the JIT will be enabled when running HHVM in GDB.
hhvm.jit_profile_interp_requestsint1 or 11Profile interpreted requests per this number of times. For the defaults, if HHVM was compiled in debug mode, then 1. Otherwise (e.g., release mode) 11.
hhvm.jit_profile_recordboolfalseIf enabled, HHVM will record a profile of requests.
hhvm.jit_profile_requestsint2147483648 or 500The number of requests to profile. For the defaults, if HHVM was compiled in debug mode, then 2147483648; otherwise (e.g., release mode) 500.
hhvm.jit_pseudomainbooltrueWhether or not to JIT pseudomains (code that doesn't exist inside a class). This is false by default on ARM.
hhvm.jit_region_selectorstringtraceletThe regions of code that will be translating the bytecode to machine code. The default is is single basic blocks, or tracelets. Other options are method and none.
hhvm.jit_relocation_sizeint1048576 (1 MB)The size of code relocation.
hhvm.jit_require_write_leaseboolfalseThe write Lease guards write access to the translation caches, srcDB, and TransDB. The term "lease" is meant to indicate that the right of ownership is conferred for a long, variable time: often the entire length of a request. If a request is not actively translating, it will perform a "hinted drop" of the lease: the lease is unlocked but all calls to `acquire(false)`` from other threads will fail for a short period of time.
hhvm.jit_retranslate_all_requestint3000 or 0The number of profile requests, before retranslating all code into optimized translations.
hhvm.jit_stress_leaseboolfalseIf HHVM was compiled in debug mode, the you can enable this setting to cede the write lease half the time.
hhvm.jit_target_cache_sizeint67108864The size, in bytes, of the target cache.
hhvm.jit_timerbooltrueTimer is used to track how much CPU time we spend in the different stages of the jit. Typical usage starts and stops timing with construction/destruction of the object, respectively. The stop() function may be called to stop timing early, in case it's not reasonable to add a new scope just for timing.
hhvm.jit_trans_countersboolfalseIf enabled, JIT translation profiling counters will be enabled.
hhvm.jit_unlikely_dec_ref_percentint10The percentage of ref counted types to destroy.
hhvm.jit_use_vtune_apiboolfalseIf enabled, the VTune API will be used for profiling.

JIT Translation Cache Size

The translation cache stores the JIT'd code. It's split into several sections depending on how often the code is (or is expected to be) executed. The sum of all the bits has to be less than 2GB.

SettingTypeDefaultDescription
hhvm.jit_a_sizeint62914560 (60 MB)Size in bytes of main translation cache.
hhvm.jit_a_cold_sizeint25165824 (24 MB)Size of cold code cache. Code that is unlikely to be executed is deemed cold. (Recommended: 0.5x hhvm.jit_a_size).
hhvm.jit_a_frozen_sizeint41943040 (40 MB)Size of extremely cold code cache. Code that is almost never executed, or executed once and then freed up, is deemed frozen. (Recommended: 1x hhvm.jit_a_size).
hhvm.jit_a_hot_sizeint0Size of hot code cache. (Enabled only in RepoAuthoritative mode when hhvm.repo.authoritative is true).
hhvm.jit_a_prof_sizeint67108864 (64 MB)Size of profiling code cache. (Recommended: 1x hhvm.jit_a_size).
hhvm.jit_a_max_usageint62914560 (60 MB)Maximum amount of code to generate. (Recommended: 1x hhvm.jit_a_size).
hhvm.jit_global_data_sizeint15728640 (15 MB)Size of the global data cache.
hhvm.tc_num_huge_cold_mbint4The number of megabytes of cold regions to hold in the translation cache.
hhvm.tc_num_huge_hot_mbint16The number of megabytes of hot regions to hold in the tranlsation cache.

PGO

These are settings of the JIT for Profile Guided Optimizations.

SettingTypeDefaultDescription
hhvm.jit_pgobooltrueTurn on PGO in the JIT. This is disabled by default for ARM.
hhvm.jit_pgo_hot_onlyboolfalseIf enabled, only profile hot sections of code.
hhvm.jit_pgo_region_selectorstringhotcfgThe regions to translate during PGO. The default are hot sections of code.
hhvm.jit_pgo_release_vv_min_percentint10The minimum percentage of extra args, varenvs and locals that will be released.
hhvm.jit_pgo_thresholdint2 or 5000The maximum amount of PGO translations. For the defaults, 2 when HHVM is compiled in debug mode; 5000 otherwise.
hhvm.jit_pgo_use_post_conditionsbooltrueFor profiling translations, grab the postconditions to be used for region selection whenever we decide to retranslate.

Garbage Collector Settings

These are settings for the automated garbage collector. To enable the automated GC, set hhvm.enable_gc to true.

SettingTypeDefaultDescription
hhvm.enable_gcboolHHVM_EAGER_GCEnable the garbage collector.
hhvm.eager_gcboolHHVM_EAGER_GCDebugging tool. Run the GC as often as possible. Only supported in Debug builds.
hhvm.filter_gc_pointsbooltrueLimit eager gc runs to once per surprise point.
hhvm.quarantineboolHHVM_EAGER_GCDebugging tool. Instead of freeing memory, mark it as a 'Hole', fill with 0x8a, and leak.
hhvm.gc_sample_rateint0
hhvm.gc_min_triggerint64 << 20
hhvm.gc_trigger_pctdouble0.5

APC Settings

These are custom HHVM settings to the Alternative PHP Cache (APC).

SettingTypeDefaultDescription
hhvm.server.apc.expire_on_setsboolfalseIf enabled, this will turn on item purging on expiration. And it is done once per hhvm.server.apc.purge_frequency of sets.
hhvm.server.apc.purge_frequencyint4096Expired items will be purged every this many APC sets.
hhvm.server.apc.purge_rateint-1Evict at most this many items on each purge. No limit if -1.

Repo Authoritative

When using HHVM's Repo-Authoritative mode, these are the settings that help configure its use.

SettingTypeDefaultDescription
hhvm.repo.authoritativebooleanfalseIf true, you are specifying that you will be using HHVM's repo- authoritative mode to serve requests.
hhvm.repo.pathstring""The path to the hhvm.hhbc file created when you compiled a repo-authoritative repo. (before HHVM 4.115: hhvm.repo.central.path)
hhvm.repo.commitbooltrueIf enabled, this will commit newly emitted units to the repo.
hhvm.repo.debug_infobooltrueIf enabled, the full source locations will be stored in the repo; otherwise, only line numbers will be stored.
hhvm.repo.journalstringdeleteIf delete, then delete the on-disk SQLite journal upon each successful transaction commit. If memory, then store the SQLite journal in memory. delete is the safer mode to use.
hhvm.repo.local.modestringr-rw to use the local repo for reading and writing (if file permissions allow). r- to use the local repo for reading (if it exists and is readable). `--`` to completely ignore the local repo, even if it exists.
hhvm.repo.local.pathstring''hhvm.repo.loca.pathor the environment variable HHVM_REPO_LOCAL_PATH (the former takes precedence) can be used to specify where the local repo is. If unspecified, then the local repo is path/to/cli.php.hhbc in cli mode or <cwd>/hhvm.hhbc in server mode.
hhvm.repo.modestringreadonlylocal to write eval units to the local repo if it is writeable; otherwise write to the central repo. central to write eval units to the central repo. readonly to not write eval units to a repo, but still search for them in repos.
hhvm.repo.preloadboolfalseIf enabled, preload all units from the repo in parallel during startup.
hhvm.disable_some_repo_auth_noticesbooltrueMake the repo authoritative notices you receive less verbose.

Statistics

These settings allow you to collect various statistics for various parts of the runtime, from web statistics and mysql to memory and the profiler.

SettingTypeDefaultDescription
hhvm.stats.enableboolfalseSet this to true in order to enable stats collection.
hhvm.stats.apcboolfalseSet this to true to enable collection APC statistics.
hhvm.stats.enable_hot_profilerbooltrueEnable the hot profiler and xhprof.
hhvm.stats.max_slotint72 (12 hours)For each page, we collect stats by time slots. Each time slot is configured as hhvm.stats.slot_duration seconds and server internally keeps the number of slots specified by this setting. Inside each slot, we keep a set of stats by page or URL. These stats include 3 built-in ones ("url", "code" and "hit") and many key-value pairs defined by different parts of the system.
hhvm.stats.memory boolfalseSet this to true to enable memory statistics.
hhvm.stats.network_ioboolfalseSet this to true to enable network I/O statistics and status.
hhvm.stats.profiler_max_trace_bufferint0The maximum size of a trace buffer in the profiler; if 0, there is no maximum.
hhvm.stats.profiler_trace_bufferint2000000The size of the profiler trace buffer array.
hhvm.stats.profiler_trace_expansiondouble1.2How much bigger to make the profiler trace buffer array when it gets full. hhvm.stats.profiler_trace_buffer * this setting.
hhvm.stats.slot_durationint600 (seconds)How long each slot described in hhvm.stats.max_slot is kept.
hhvm.stats.sqlboolfalseIf set to true, this will enable the collection of MySQL connection statistics.
hhvm.stats.sql_tableboolfalseIf set to true, this will enable the collection of MySQL table statistics.
hhvm.stats.webboolfalseIf set to true, this will enable the collection of web/server statistics.
hhvm.stats.xslstring''Stats are written as XML. If this is set to something non-empty, the XSL used for the XML is referred to by that setting.
hhvm.stats.xsl_proxystring''Stats are written as XML. If this is set to somehing non-empty, the XSL proxy used for the XML is referred to by that setting.

Resource Limits

These are resource limit settings such as how often to check maximum memory and the default socket timeout.

SettingTypeDefaultDescription
hhvm.resource_limit.core_file_sizeint0If set to something > 0, then this is the maximum size of a core dump file. If 0, the no core dumps are created.
hhvm.resource_limit.drop_cache_cycleint0If set to something > 0, then this is how often the disk cache is dropped.
hhvm.resource_limit.max_rssint0If set to something > 0, then this is the maximum amount of memory (in bytes) of the HHVM process should get.
hhvm.resource_limit.max_rss_polling_cycleint0If set to something > 0, then this is how often to check whether we are hitting our hhvm.resource_limit.max_rss limit.
hhvm.resource_limit.max_sql_row_countint0If set to something > 0, then this is the maximum number of rows that will be fetched at any given time.
hhvm.resource_limit.serialization_size_limitint2146435072 (~2 GB)The maximum size of a serialized string.
hhvm.resource_limit.socket_default_timeoutint60The amount of time (in seconds) before an unused socket times out.

Regular Expressions

These are the settings you can toggle for HHVM's PCRE implementation.

SettingTypeDefaultDescription
hhvm.preg.backtrace_limitint1000000The maximum bind length a call to something like preg_replace_callback() can make.
hhvm.preg.error_logbooltrueIf a PRCE error occurs, then it will be logged if this is enabled.
hhvm.preg.recursion_limitint100000The maximum recursion limit for PCRE. Setting this value too high could cause the utilization of all of the process stack.
hhvm.pcre_cache_typestringstaticMay be static, for a very fast cache which never evicts, lru, for a cache which evicts the least-recently used item when full, or scalable for a cache which is slightly slower than lru at low concurrency but much faster for a high-concurrency tight-loop workload.
hhvm.pcre_table_sizeint0The number of patterns which can be stored in the PCRE cache.

MySQL

These setting control the behavior of the HHVM MySQL extension.

SettingTypeDefaultDescription
hhvm.mysql.typed_resultsbooltrueZend returns strings and null only for MySQL results, not integers or floats. HHVM return ints (and, sometimes, actual doubles). This behavior can be disabled by setting this to false.
hhvm.mysql.slow_query_thresholdint1000In milliseconds, log slow queries as errors.
hhvm.mysql.read_onlyboolfalseIf enabled, the database is read only.
hhvm.mysql.read_timeoutint60000How long, in milliseconds, before a read query times out.
hhvm.mysql.connect_timeoutint1000How long, in milliseconds, before a connection times out.
hhvm.mysql.wait_timeoutint-1If positive, how long, in milliseconds, before a wait timeout.
hhvm.mysql.kill_on_timeoutboolfalseIf enabled, when a query takes long time to execute on server, client has a chance to kill it to avoid extra server cost.
hhvm.mysql.max_retry_open_on_failint1How many times to retry opening a connection if the first time failed.
hhvm.mysql.max_retry_query_on_failint1How many times to retry a query if the first time failed.
hhvm.mysql.socketstring''Default location to look for mysql.sock.

Advanced Settings

These are settings that generally won't be used by most users of HHVM. Some won't be documented, other than the type and default value.

HHIR

These settings control various aspects of the HHVM Intermediate Representation (HHIR).

SettingTypeDefault
hhvm.hhir_alloc_simd_regsbooltrue
hhvm.hhir_licmboolfalse
hhvm.hhir_dead_code_elimbooltrue
hhvm.hhir_direct_exitbooltrue
hhvm.hhir_enable_coalescingbooltrue
hhvm.hhir_enable_gen_time_inliningbooltrue
hhvm.hhir_enable_pre_coloringbooltrue
hhvm.hhir_gen_optsbooltrue
hhvm.hhir_generate_assertsbooltrue (if HHVM was compiled in debug mode); false otherwise.
hhvm.hhir_global_value_numberingbooltrue
hhvm.hhir_inline_frame_optsbooltrue
hhvm.hhir_inline_singletonsbooltrue
hhvm.hhir_inline_region_modestring"both"
hhvm.hhir_inlining_max_bind_jmpsint0
hhvm.hhir_inlining_max_costint13
hhvm.hhir_pgo_inlining_max_costint6
hhvm.hhir_inlining_max_depthint4
hhvm.hhir_inlining_max_return_dec_refsint6
hhvm.hhir_inlining_max_returnsint3
hhvm.hhir_memory_optsbooltrue
hhvm.hhir_outline_generic_inc_dec_refbooltrue
hhvm.hhir_prediction_optsbooltrue
hhvm.hhir_refcount_optsbooltrue
hhvm.hhir_simplificationbooltrue
hhvm.hhir_store_prebooltrue
hhvm.hhir_stress_spillbooltrue
hhvm.hhir_type_check_hoistingboolfalse

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.

SettingTypeDefault
hhvm.xbox.default_local_timeout_milli_secondsint500
hhvm.xbox.default_remote_timeout_secondsint5
hhvm.xbox.process_message_funcstringxbox_process_message
hhvm.xbox.server_info.always_resetboolfalse
hhvm.xbox.server_info.log_info boolfalse
hhvm.xbox.server_info.max_durationint120
hhvm.xbox.server_info.max_queue_lengthintINT_MAX
hhvm.xbox.server_info.max_requestint500
hhvm.xbox.server_info.portint0
hhvm.xbox.server_info.request_init_documentstring''
hhvm.xbox.server_info.request_init_functionstring''
hhvm.xbox.server_info.thread_countint10
hhvm.xbox.server_info.warmup_documentstring''
hhvm.xbox.passwordstring'' (not ini_get() enabled)
hhvm.xbox.passwordsSet<string>empty (not ini_get() enabled)

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.

SettingTypeDefault
hhvm.pagelet_server.queue_limitint0
hhvm.pagelet_server.thread_countint0
hhvm.pagelet_server.thread_drop_cache_timeout_secondsint0
hhvm.pagelet_server.thread_drop_stackboolfalse
hhvm.pagelet_server.thread_round_robinboolfalse

Emitter

Settings for the HHVM compiler code emitter.

SettingTypeDefault
hhvm.emit_switchbooltrue
hhvm.enable_emitter_statsbooltrue
hhvm.random_hot_funcsboolfalse

Xenon

Settings for the Xenon server, which snapshots server activity at regular intervals, showing which code is on CPU.

SettingTypeDefaultDescription
hhvm.xenon.force_always_onboolfalseGather PHP and async stacks at every function enter/exit. This will gather potentially large amounts of data and is mostly useful for small script debugging.
hhvm.xenon.perioddouble0.0Configure Xenon to gather PHP and async stacks every this many seconds.

Mail

These are settings for the Mail extension.

SettingTypeDefault
hhvm.mail.force_extra_parametersstring''
hhvm.mail.sendmail_pathstringsendmail -t -i

Code Checks

These settings are for toggling various code checks (e.g., typehints).

SettingTypeDefaultDescription
hhvm.check_flush_on_user_closebooltrueDetermines whether or not close() for user streams (registered by stream_wrapper_register()) will consider the return value of the implicit call to `flush()`` when calculating its return value.
hhvm.check_return_type_hintsint2Whether to check return type hints at runtime, and if so how. 0 means no return type checking. 1 - Raises E_WARNING if a return type hint fails. 2 - Raises E_RECOVERABLE_ERROR if regular return type hint fails, raises E_WARNING if soft return type hint fails. If a regular return type hint fails, it's possible for execution to resume normally if the user error handler doesn't throw and returns something other than boolean false. 3 - Same as 2, except if a regular type hint fails the runtime will not allow execution to resume normally; if the user error handler returns something other than boolean false, the runtime will throw a fatal error (this goes together with hhvm.hard_return_type_hints).
hhvm.hard_return_type_hintsboolfalseCheck hard return type hints. Only used when compiling.
hhvm.check_sym_linkbooltrueWhether to follow symlinks when looking up units in the bytecode cache.

Profiling

These are additional settings for the HHVM profiler. HHProf uses jemalloc per heap profiling.

SettingTypeDefault
hhvm.profile_bcboolfalse
hhvm.profile_heap_across_requestsboolfalse
hhvm.profile_hw_enablebooltrue
hhvm.profile_hw_eventsstring''
hhvm.hh_prof.enabledboolfalse
hhvm.hh_prof.activeboolfalse
hhvm.hh_prof.accumboolfalse
hhvm.hh_prof.requestboolfalse
hhvm.record_code_coverageboolfalse
hhvm.code_coverage_output_fileboolfalse
hhvm.hot_func_countint4100
hhvm.num_single_jit_requestsint5 (in server mode); 0 otherwise

Proxies

These are settings for reverse proxying.

SettingTypeDefault
hhvm.proxy.originstring''
hhvm.proxy.percentageint0
hhvm.proxy.proxy_patternsVector<string>empty
hhvm.proxy.proxy_urlsSet<string>empty
hhvm.proxy.retryint3
hhvm.proxy.serve_urlsSet<string>empty

Other

Here are some other HHVM settings that may be useful in an advanced situation.

SettingTypeDefaultDescription
hhvm.allow_hhasboolfalseAllow executing HHVM Assembly (hhas) files, which is code written directly in HHVM Bytecode (HHBC). Directly writing HHBC can easily crash HHVM, and is rarely a useful thing to do anyways.
hhvm.spin_on_crashboolfalseIf enabled, when HHVM crashes, this will wait for the debugger to attach to the pid.
hhvm.simulate_armboolfalseIf enabled, this will allow HHVM to simulate running on ARM architecture.
hhvm.timeouts_use_wall_timebooltrueDetermines whether or not to interpret set_time_limit timeouts as wall time or CPU time.
hhvm.dynamic_extension_pathstring.path to look for extensions if a fully qualified path is not provided. The current path is the default.
hhvm.gdb_sync_chunksint128This forces the VM to sync debug info synchronously with gdb, this many chunks at a time.
hhvm.hhbc_arena_chunk_sizeint10485760 (1 MB)The chunk size for the HHBC arena.
hhvm.initial_named_entity_table_sizeint30000The initial size of the named entity table.
hhvm.initial_static_string_table_sizeint500000The initial size of the static string table.
hhvm.map_tc_hugeboolfalse
hhvm.map_tgt_cache_hugeboolfalse
hhvm.max_low_mem_huge_pagesint0
hhvm.vm_initial_global_table_sizeint512The initial global table size.s
hhvm.vm_stack_elmsint16384The maximum stack size.

Unused Settings

These are settings that are currently not used in the codebase.

SettingTypeDefault
hhvm.enable_alternativeint0
hhvm.server.enable_cuf_asyncboolfalse
hhvm.server.lib_event_sync_sendbooltrue
hhvm.server.response_queue_countint0
hhvm.server.shutdown_listen_no_workint-1
hhvm.debug.full_backtraceboolfalse
hhvm.debug.local_memcacheboolfalse
hhvm.debug.memcache_read_onlyboolfalse
hhvm.debug.translate_leak_stack_traceboolfalse
hhvm.debug.translate_sourceboolfalse
hhvm.error_handling.enable_hip_hop_errorsbooltrue
hhvm.error_handling.max_loop_countint0
hhvm.error_handling.warn_too_many_argumentsboolfalse
hhvm.hack_array_warn_frequencyint0
hhvm.resource_limit.max_memcache_key_countint0
hhvm.resource_limit.string_offset_limitint10 * 1024 * 1024 (10 MB)