Just installed HHVM and trying to run a simple index.php file, but getting the error below:
"Fatal error: Uncaught Error: Not a Hack file"
Commands that produce the error above:
hhvm index.php
hhvm --php index.php
index content::
<?php
phpinfo();
hhvm version: HipHop VM 4.86.1
Note: I can run a hack file without any issue via command line or via FastCGI.
hhvm fib.hack (run with no problem)
Am I missing a flag or a configuration setting? All the tutorials that I have been able to find online state that hvvm should be able to run php with no issue out of the box.
Any help will be appreciated.
You'll enter into other issues but as a first step try using
<?hhinstead of<?phpbecause it is not allowed in the latest versions of HHVM. The.phpextension is still allowed but not the header of the file:After that you'll enter into issues like "Uncaught Error: Found top-level code" for which you'll need to wrap the code inside an entry point function by adding the attribute and the function as follows:
After that you'll enter into other issues because of the use of
phpinfo()and other PHP functions because the HHVM guys are trying to limit PHP usage for some reason.