ubuntu-9.10上安装facebook xhp

building xhp

http://wiki.github.com/facebook/xhp/building-xhp

download xhp

http://github.com/facebook/xhp/downloads

 sudo apt-get install php gcc flex bison re2c phpize ./configure make sudo make install

add xhp config file to php

 sudo vi /etc/php5/conf.d/xhp.ini# add below line to xhp.ini fileextension=xhp.so

test xhp

If you get a syntax error then XHP is not working.

 php -r 'echo "XHP!\n"; exit; <a />;'

xhp configure

  1. 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.

  2. 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.