Search code examples
ubuntunginxubuntu-14.04hhvmhacklang

HHVM is installed, but typechecker is missing from environment according to error.log


I start with the following inside of a file:

<?php phpinfo();

It outputs the following:

HHVM Version 3.12.1
...etc...

I change the file to this:

<?hh phpinfo();

I get a server error 500 response, then I check the hhvm log in /var/log/hhvm/error.log:

Fatal error: /path/to/my/file.php appears to be a Hack file, but you do not appear
to be running the Hack typechecker. See the documentation at 
http://docs.hhvm.com/hack/typechecker/setup for information on getting it running.
You can also set `-d hhvm.hack.lang.look_for_typechecker=0` to disable this check
(not recommended).

The link to the docs provided in the error message takes me to a page that assumes that the typechecker is already installed. However, it provides a link for installing the typechecker. Clicking on that link tells me this:

There are two ways to get the typechecker: automatically when you install HHVM or
by compiling it.

Ah, but I did install HHVM, which is how I got my first output shown above:

HHVM Version 3.12.1
...etc...

Furthermore, the documentation says this:

The typechecker client is generally installed at /usr/bin/hh_client while the
typechecker server is generally installed at /usr/bin/hh_server.

This is what I see when I run $ ls -la /usr/bin/hh_client /usr/bin/hh_server

-rwxr-xr-x 1 root root 3689005 Feb 29 22:07 /usr/bin/hh_client
-rwxr-xr-x 1 root root 3876085 Feb 29 22:07 /usr/bin/hh_server

From all indications, the typechecker looks like it is installed!

Here is how I installed it on Ubuntu 14.04:

sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449
sudo add-apt-repository "deb http://dl.hhvm.com/ubuntu $(lsb_release -sc) main"
sudo apt-get update
sudo apt-get install hhvm
sudo update-rc.d hhvm defaults
sudo /usr/share/hhvm/install_fastcgi.sh

Inside of /etc/hhvm/server.ini I have this:

;hhvm.server.port = 9000
hhvm.server.file_socket=/var/run/hhvm/hhvm.sock

I have ensured the following is in place in all of my configurations:

fastcgi_pass unix:/var/run/hhvm/hhvm.sock;

I have restarted all servers.

I have performed this entire process on two different systems running Ubuntu 14.04 (including a fresh minimal install of Ubuntu 14.04), with the same results.


Solution

  • The problem is that you haven't set your code up for type checking, not that the type checker isn't installed. As per the documentation the error sends you to, you need to create a .hhconfig file at the root of your code base.