Search code examples
phphhvm

HHVM not starting correctly?


After installing everything on Ubuntu Server 16, my testfile shows that HHVM is not started. At the same time sudo service hhvm status tells me that the status is active (exited) and that it cannot open /var/log/hhvm/error.log

restarting the server gives no errors but i can not get HHVM completely up and running. The testfile is a simple if/else PHP file in var/www/html like the following.

<?php

if (defined('HHVM_VERSION')) {

echo 'hhvm is working';
} else {

echo 'hhvm is not working' ;
}
?>

Where does this status come from(i already found it might have something to do with the daemon, but i can start the daemon without issues) and how can i fix it?

I already tried the few solutions that i could find, but without succes. :( I am using HHVM with Apache.

edit in response to @hanshendrik

Thanks, your top command shows the first 2 results being equal to the example. then drwxrwxr-x root syslog log and for hhvm: no such file or directory. So i made the hhvm folder and changed the group to www-data. It has drwxr-xr-x rights and the error.log has -rw-rwxr-- rights. However, the problem is not yet solved. It doesn't give the warnings anymore but still says active(exited)and shows that the HHVM fastcgi Daemon started

Edit, partially solved My testsite still says HHVM is not working though... :(


Solution

  • probably a permission issue, first run sudo su name-of-account-hhvm-is-started-as-here -s /bin/bash (for example, sudo su www-data -s /bin/bash) then run namei -l /var/log/hhvm/error.log, and the point where it fails should be revealed. for example, the output might be

    namei -l /var/log/hhvm/error.log
    f: /var/log/hhvm/error.log
    drwxr-xr-x root root /
    drwxr-xr-x root root var
    drwxr-xr-x root root log
    drwx------ root www-data hhvm
                         error.log - No such file or directory
    

    here, because the owner is root, and only the owner has execute permissions on the folder, only the owner (root) can open any files inside it, and the fix would be chmod g+x /var/log/hhvm. or the output might be

    drwxr-xr-x root root       /
    drwxr-xr-x root root       var
    drwxr-xr-x root root       log
    drwx--x--- root www-data hhvm
    -rw-r--r-- root www-data error.log
    

    here, owner and group has execute permissions on the folder, but only the owner has write access to error.log, and the fix would be chmod g+w /var/log/hhvm/error.log,... good luck