HHVM crash with version 3.18.0

If you installed the last version of HHVM (version 3.18.0) and restart your server or HHVM then you get the following error within /var/log/nginx/error.log:

connect() to unix:/var/run/hhvm/hhvm.sock failed (111: Connection refused) while connecting to upstream …

and within /var/log/hhvm/error.log:

Failed to initialize central HHBC repository:\n Failed to initialize schema in /var/run/hhvm/hhvm.hhbc(rw-r–r– root:root): \n Failed to open /var/www/.hhvm.hhbc: 14 – unable to open database file\n

The problem is with the new version hhvm creates the hhvm.hhbc with the user root and the user www-data can’t access the file. A workaround is to specify the user within the /etc/hhvm/server.ini:

hhvm.repo.central.file_user=www-data
hhvm.repo.central.file_group=www-data
hhvm.repo.central.file_mode=493

then restart hhvm with:

/etc/init.d/hhvm restart

That’s all 🙂

Source: https://milliondollarserver.com/hhvm-3-18-0-crash-on-ubuntu-16-04-with-nginx.html