Tuesday, July 20, 2010

ubuntu 9.10 上安装facebook XHP


1. Download xhp from http://github.com/facebook/xhp/downloads

$> sudo apt-get install php gcc flex bison re2c

$> phpize
$> ./configure
$> make
$> sudo make install

3. add xhp config file to php
$> sudo vi /etc/php5/conf.d/xhp.ini
# add below line to xhp.ini file

4. test xhp, if you get a syntax error then XHP is not working.
$> php -r 'echo "XHP!\n"; exit; <a />;'

5. xhp configure
xhp.idx_expr = {1 | 0} (default: 0): This is a bonus feature of XHP which adds support for the [] operator on the return value of a function. If you enable this you will be able to write code like foo()['bar'] without hitting syntax errors. This configuration is mainly around to fix a personal annoyance with PHP's grammar, and has nothing to do with XHP's core features.

xhp.include_debug = {1 | 0} (default: 1): You can disable XHP node annotations by turning this setting off. This may in some cases marginally increase performance of XHP-heavy code. It is highly recommended that you leave this on, as tracking errors in XHP applications is very difficult without annotations.

No comments :