Search code examples
phpvagrantubuntu-14.04fastcgihhvm

HHVM FastCGI not working properly - no response


I'm new to HHVM and started to configure it in my Vagrant Machine to run as FastCGI but when I hit localhost:9000 in the browser It responses nothing but error

ERR_EMPTY_RESPONSE

but If I stop service using sudo service hhvm stop and run HHVM as normal runtime server by using hhvm -m server -p 9000 and hit the browser with localhost:9000 URL and it perfects fine,

The below is the configuration data in /etc/hhvm/server.ini

; php options

pid = /var/run/hhvm/pid

; hhvm specific

hhvm.server.port = 9000
hhvm.server.type = fastcgi
hhvm.server.default_document = index.php
hhvm.log.use_log_file = true
hhvm.log.file = /var/log/hhvm/error.log
hhvm.repo.central.path = /var/cache/hhvm/hhvm.hhbc
hhvm.server.source_root = /vagrant/www

This is from where I got help to set up FastCGI https://docs.hhvm.com/hhvm/basic-usage/proxygen#automatic-service-startup

How can I run it as automatic startup service?

Any help would be appreciated. Thanks in advance :)


Solution

  • A browser can't connect to a server running in FastCGI mode, as browsers talk HTTP not FastCGI. Instead, you need to set up a web server (e.g. Apache/Nginx) and have that talk with the browser and the FastCGI server.

    The document for running HHVM+FastCGI contains instructions for setting this up with both Apache and Nginx.