HipHop/HHVM can be run as a daemon (so it starts automatically after rebooting) with
sudo /usr/bin/hhvm --mode daemon --config /etc/hhvm/server.hdf
When run, it works perfectly (which shows that the configs are okay). But after restarting the machine HHVM is gone and needs to be restarted manually. The above line incl. the configs have been taken out of official tutorials of the HHVM creators. Classic service syntax like sudo service hhvm start
also works perfectly, but doesn't survice a machine restart.
What I've done to track down the problem:
The HHVM error log in /var/log/hhvm/error.log logs this line at each restart: Unable to open pid file /var/run/hhvm/pid for write
. /etc/hhvm/server.hdf
has PidFile = /var/run/hhvm/pid
in first line. As this ships with HHVM by default, I don't want to change it. I think the sudo is the problem here. Without sudo HHVM won't run. Chmod 777'ing the pid file and pointing to another empty file don't solve the problem.
Question:
What's the correct way to install HHVM as a daemon ?