Extensions

HHVM provides dozens of built-in, integrated extensions and allows for other extensions to be dynamically loaded. Since this is an HHVM user's guide, this does not discuss how to build your own extension, but there are resources for that listed below.

Integrated Extensions

If you call get_loaded_extensions() from HHVM, you will find that the following extensions are integrated into HHVM

This documentation links to the PHP documentation about PHP extensions. It is however important to keep in mind that hhvm has been slowly drifting away from PHP. Most extensions have the features that they had in PHP 7.0 or 7.1. Features added in newer releases of PHP may not have been implemented. Some functionality may be missing or may not have typechecker definitions.

Some APIs may have changed (think of &$references to inout changes). Some functions may have been split up into multiple functions if the PHP function took an optional &$reference argument. For the most up-to-date function signatures, please refer to your version of the typechecker definitions.

Dynamically Loaded Extensions

Loading

To load a dynamically loaded extension, follow the instructions for that extension. However, it generally goes like this:

cd /path/to/extension
hphpize
cmake .
make

This will create an .so file. Then in your configuration .ini file:

extension_dir = /etc/hhvm
hhvm.extensions[extension_name] = extension.so

or

hhvm.dynamic_extensions[extension_name] = extension.so

Building Your Own Extension

Creating your own extension is beyond the scope of this user guide, but there are some good external resources to help get you started:

http://blog.golemon.com/2015/01/hhvm-extension-writing-part-i.html

Was This Page Useful?
Thank You!
Thank You! If you'd like to share more feedback, please file an issue.