3

I'm having trouble getting hhvm to start when my Amazon Linux (which is apparently very similar to Centos) EC2 instance starts. When I reboot the server hhvm doesn't come up, and there's nothing in the error logs. When I use

sudo service hhvm start

it comes up just fine. Stop/restart works fine too. When I try running the following as ec2-user

service hhvm start

I get these errors

[ec2-user@ip-x ~]$ service hhvm start
Starting hhvm: [Fri Jan  8 22:35:13 2016] [hphp] [2451:7fe8751566c0:0:000001] [] Cannot open log file: /var/log/hhvm/error.log [  OK  ]
touch: cannot touch ‘/var/lock/subsys/hhvm’: Permission denied

I deleted my /var/log/hhvm/error.log and restarted the server. There was nothing in the error log.

As background, I installed hhvm using 'yum install nginx' from the amazon repository. I'm using the /etc/init.d/hhvm that was installed by yum.

When hhvm is running after being started by root I get this from ps -ef | grep hhvm

[root@ip-x init.d]# service hhvm restart
Stopping hhvm:                                             [  OK  ]
Starting hhvm:                                             [  OK  ]
[root@ip-x init.d]# ps -ef | grep hhvm
tim       2555     1  3 22:41 ?        00:00:00 hhvm --config /etc/hhvm/server.ini -d pid=/var/run/hhvm.pid --user tim --mode daemon
root      2560  2458  0 22:42 pts/0    00:00:00 grep --color=auto hhvm

nginx comes up just fine, with its own config file. hhvm package is hhvm-3.6.6-1.amzn1.x86_64.

Any ideas? Any information anyone can give me? I understand the startup script runs as root but starts as the user specified - in my case "tim". "tim" is a member of the root group, which I did recently to try to fix the issue.

I reference this question, which is for Ubuntu. I tried it, but it didn't work.

Here's the startup file in /etc/init.d/hhvm

  • As an extra fail safe, consider a utility like Monit, which will check whether it is up, and if not, attempt to start it. – JayMcTee Jan 9 '16 at 18:11
  • #JayMcTee Monit looks awesome, thanks for the tip! – Tim Jan 9 '16 at 18:52
2

Seems the answer is

/sbin/chkconfig --add hhvm
1

For CentOS 7, if your service is SysV compatible then (as you discovered) use chkconfig, If it is a native systemd service then use systemctl enable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.