Question

I've installed hack-nightly and set up fastcgi using nginx by following the instructions on the website, however I'm getting an error when trying to create a simple file that uses xhp:

<?hh
$x = <html><body>hello</body></html>;
echo $x->toString();

Error:

Fatal error: Class undefined: xhp_html in /

Is there a step I need to take to enable this, or an additional import or package to install?

Était-ce utile?

La solution

You need to include the XHP library, which you can find here. This defines the :xhp base class as well as all the HTML classes. Put all three files somewhere in your source tree then include init.php before doing anything with XHP.

There's currently a discussion going on in the HHVM.dev group on Facebook about if the library should be included by default or not, which you can view at https://www.facebook.com/groups/hhvm.dev/229787297210377/.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top