Does Gravity Forms Support HHVM?

While Gravity Forms is not tested on HHVM, in many cases it will operate properly out of the box or with a few modifications. As HHVM does have some incompatibilities with standard PHP releases, issues can arise from time to time and not all of these can be addressed. In this article, we will list any workarounds that may be required when running Gravity Forms with HHVM.

Correcting File Upload Errors

The File Upload field may have issues in some HHVM setups due to how the WordPress wp_max_upload_size function retrieves the values of the PHP upload_max_filesize and post_max_size settings. To correct this, simply place the following in your theme’s functions.php file (or ideally within its own plugin):

add_filter( 'upload_size_limit', function() {
    $u_bytes = wp_convert_hr_to_bytes( ini_get( 'hhvm.server.upload.upload_max_file_size' ) );
    $p_bytes = wp_convert_hr_to_bytes( ini_get( 'hhvm.server.max_post_size' ) );

    return min( $u_bytes, $p_bytes );
} );