Search code examples
nginxhhvmhacklang

Getting undefined class while using XHP with HHVM although the necessary includes have been made


I'm using nginx 1.6.2, with ubuntu 14.04 and hhvm 3.3.0.

My server is configured locally and I'm able to access its pages and execute regular hack scripts.

The problem comes when I try to execute scripts that have to include the XHP library. They work perfectly if I call then from command line: hhvm index.php executes with the expected output, but if I try open the page from a browser hhvm logs the xhp undefined class error.

This is my setup:

ls
index.php  info.php  xhp

ls xhp
core.php  html.php  init.php

This is the index.php file:

<?hh 
error_log("Entered Index", 0);
require_once('xhp/init.php');
$body = "www.facebook.com";
echo <a href = {$body} >facebook</a>;

This is the info.php file:

<?hh
echo  defined('HHVM_VERSION')?'Using HHVM':'Not using HHVM';

The other files are taken from:https://github.com/facebook/xhp/tree/hack/php-lib

If I put a error_log in the beggining of init.php, it outputs the error if executed from bash but doesn't output anything if run from the browser(except for the undefined class error).

Nginx also doesn't give me any errors.

If I access info.php from the browser it gives me the expected output:"Using HHVM"

Thank you.


Solution

  • File permissions were set incorrectly, there was no read flag on other for the init.php,core.php and html.php files.