I have try to move from Apache + cli_php to NGINX+HHVM(3.8) on Debian. The problem is HHVM couldn't load some includes (/var/www/site/inc/inc.php).
/var/www/site/index.php
/inc/inc.php
Browser error is 502 Bad Gateway.
I tried to set these options in server.ini
with no luck. Does it make any sense?
hhvm.sandbox.directories_root = /
hhvm.source_root = /
hhvm.sandbox.home = /
hhvm.server.always_use_relative_path = false
nginx:
server {
server_name localhost;
root /var/www/site;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
include hhvm.conf; #standard 3.8
}
In addition, did I mention right that in error messages HHVM remove first part of the include path before actually site-root?
The problem was in DOS endline characters. Look like HHVM doesn't interpret it right. In browser you get 502 Bad Gateway error, but terminal hhvm error is file not found
. Also strange -- if there is echo output in that included file -- problem disappear.
So I convert included file with dos2unix and problem has been solved.
To find out all php files and convert it to unix-style, run this in the root directory of the site:
apt-get install dos2unix
find . -name "*.php" -exec dos2unix {} \;