How to upgrade from HHVM to PHP 7

in PerformancePHP & HHVM

Now that PHP 7 is widely used in production, HHVM doesn’t offer the benefits it used to. PHP 7 is just as fast and it leaves behind many of the instability issues that are associated with HHVM. This article is a short guide on how to configure a shop that is currently running on HHVM to run fast and stable with PHP 7.

1. Replace all HHVM handlers

If you configured HHVM according to our knowledgebase guide, you can simply replace all

echo_exec @hhvm; 

statements with

echo exec @phpfpm;

It is very likely that you can simplify your configuration a lot if in the past you made a distinction between different locations on your website. With PHP 7.0 you can use the @phpfpm handler site wide and still enjoy hhvm-like speeds.

location ~ \.php$ {
    echo_exec @phpfpm;
}

You can find all the HHVM handlers you configured with grep

app@cj8iiu-willem-magweb-do:~$ grep --recursive --line-number '@hhvm' nginx
nginx/handler.conf:19:#    echo_exec @hhvm;
nginx/handler.conf:38:#    echo_exec @hhvm;
nginx/handler.conf:50:#    echo_exec @hhvm;
nginx/handler.conf:54:#    echo_exec @hhvm;
nginx/handler.conf:66:#        echo_exec @hhvm;
nginx/handler.conf:85:#    echo_exec @hhvm;

2. Check the crontab for scripts that use HHVM

Check the crontab and look for jobs that run with HHVM as the interpreter

app@cj8iiu-willem-magweb-do:~$ crontab -l
*/5 * * * * flock -n ~/cron.lock hhvm-f /data/web/public/cron.php >  /dev/null 2> /dev/null

Edit the crontab with crontab -e and replace hhvm with php.

app@cj8iiu-willem-magweb-do:~$ crontab -l
*/5 * * * * flock -n ~/cron.lock php -f /data/web/public/cron.php >  /dev/null 2> /dev/null

3. Replace HHVM as the interpreter in your command line scripts

Some people have also configured their shop to use HHVM for command line scripts by specifying an interpreter line (shebang).

In all your scripts that start with:

#!/usr/bin/env hhvm

Or

#/usr/bin/hhvm

Replace that line with

#/usr/bin/env php

4. Update your Hypernode to PHP 7 if you haven’t already

Follow the PHP 7 guide to double check your site’s compatibility and update your Hypernode’s PHP version in the Service Panel.

https://support.hypernode.com/knowledgebase/php-7/

0