hhvm (1) - Linux Manuals
hhvm: Execute PHP and Hack files
NAME
hhvm - Execute PHP and Hack files
SYNOPSIS
hhvm [OPTIONS] [-f] file [[--]args...]hhvm --php [PHP-OPTIONS] [-f] file [[--]args...]
DESCRIPTION
hhvm(1) (aka the HipHop Virtual Machine) is an open-source virtual machine designed for executing programs written in Hack and PHP. HHVM uses a just-in-time compilation approach to run programs. HHVM should be used standalone for command line (CLI) scripts or together with a FastCGI-based web server like nginx or apache to serve websites.This is the command line interface to HHVM.
The simplest way to parse and execute a program is providing a single parameter of a filename. Specifying -f before the filename does this in a more explicit fashion, and allows other OPTIONS to follow.
HHVM has its own set of OPTIONS , but also has the ability to behave like PHP 5.x as well. When the --php flag is specified to hhvm(1) (or the binary is named php ), options available to PHP 5.x can be used.
You may use:
- sudo /usr/bin/update-alternatives --install /usr/bin/php php /usr/bin/hhvm 60
to force hhvm(1) to be used even if PHP 5.x is installed on the system.
FILES
These are the default configuration files for HHVM. Right now both .ini and .hdf are supported as HHVM continues to migrate completely to .iniphp.ini
The default ini settings for hhvm(1) are found in /etc/hhvm/php.ini
config.hdf
The default hdf options for hhvm(1) are found in /etc/hhvm/config.hdf
OPTIONS
These are the options you can specify to the hhvm(1) executable.
- -a, --interactive
-
Shortcut for the
--mode
debug
command line option.
- --admin-port PORT
-
Start admin listener at a specified port. The default value for
PORT
is
-1.
- --arg ARG
-
Other arguments.
- --build-id ID
-
Unique identifier to compiled server code.
- -c , --config FILE
-
Load specified config (.hdf or .ini)
FILE.
Use multiple
-c
to specify multiple config files.
- --compiler-id
-
Display the git hash for the compiler.
- --count NUM
-
How many times to repeat execution. The default value for
NUM
is
1.
- -d , --define SETTING
-
Define an ini setting in the same format ( foo[=bar] ) as provided in a .ini file.
- --debug-cmd ARG
-
In
--mode
debug
, this executes the debugger command specified by
ARG
and returns its output in stdout. Multiple
--debug-cmd
can be specified to execute more than one command.
- --debug-config FILE
-
In
--mode
debug
, load the specified debugger configuration
FILE.
- --debug-extension ARG
-
In
--mode
debug
,
ARG
specifies which debugger extension PHP file to load.
- --debug-port PORT
-
In
--mode
debug
, connect to the debugger server at specified
PORT.
- --debug-sandbox ARG
-
In
--mode
debug
, initial sandbox to attach to when the debugger is started. The default for
ARG
is "default".
- --extra-header ARG
-
An extra-header to add to the front of each line of logging.
- -f , --file FILE
-
In
--mode
run
, execute the specified
FILE .
- -h , --debug-host ADDRESS
-
In
--mode
debug
, connect to debugger server at specified address. The default for
ADDRESS
is
localhost.
- --help
-
Display the list of command line options with short descriptions.
- --instance-id ID
-
Unique identifier of server instance.
- -l , --lint FILE
-
Run lint on the specified
FILE.
- -m , --mode MODE
-
MODE
can be any of the following values:
-
- •
- run (default): directly executes the program from the command line.
- •
- debug (d): starts the debugger.
- •
- server (s): starts an HTTP server from command line.
- •
- daemon: starts an HTTP server and runs it as a daemon.
- •
- replay: replays a previously recorded HTTP request file.
- •
- translate (t): translates a hex-encoded stacktrace.
-
- --no-config
-
Do not use the default php.ini
- --no-safe-access-check BOOL
-
Whether to allow any file or directory access without security checking. The default value is
0
(or false).
- -p , --port PORT
-
Start an HTTP server at the specified port. The default
PORT
is
-1.
- --php
-
Emulate the standard
php(1)
command line. You can specify the options allowed in PHP 5.x.
- --port-fd FD
-
Use the specified
FD
for HTTP instead of creating a socket. The default value is
-1.
- --ssl-port-fd FD
-
Use the specified
FD
for SSL instead of creating a socket. The default value is
-1.
- --repo-schema
-
Display the repository schema id.
- --temp-file FILE
-
FILE
specified is temporary and removed after execution.
- -u , --user USER
-
Run server under the specified
USER
account.
- -v , --config-value SETTING
-
Individual configuration string in HDF format (name=value), where name can be any valid configuration for a config file. e.g., Section.Name=Value.
- --version
-
Display the
hhvm(1)
version number.
- -w , --show FILE
-
Directly output the specified
FILE
and do nothing else.
- --xhprof-flags FLAGS
-
Set the XHProf run flags.
PHP-OPTIONS
These are the options you can specify to the hhvm(1) executable when explicitly specifying the --php flag, or when the binary is named php . All PHP 5.x options are not supported at this point in time; we are planning to continue to add more option support.
- -a, --interactive
-
Similar to the same option when not specifying
--php .
Run HHVM interactively. This lets you enter snippets of PHP code that directly get executed.
- -c FILE
-
Use the specified
FILE
for configuration options. The file should be .ini format.
- -d SETTING
-
Define INI entry specified by
SETTING
of the form
foo=[bar] .
- -n
-
Do not use any configuration (e.g., .ini) file when executing.
- -r CODE
-
Run HHVM code without using script tags, directly on the command line.
- -v
-
Output the current HHVM build version number.
- -w
-
Output source with stripped comments and whitespace.
- -z FILE
-
Load a dynamic extension file.
EXAMPLES
- hhvm foo.php
-
Execute a PHP file.
- hhvm -c custom.ini foo.php
-
Execute a PHP file given a certain configuration.
- hhvm --php -r 'echo "Hello Everyone!";'
-
Execute code from the command line using the --php option and -r.
- hhvm -m server --port 9090
-
Execute HHVM in server mode using a specified port.