Facebook released a tool that converts PHP code to C ++, hiphop
If your website is large and a large portal like Sina, consider it.
It has been compiled on centos, Ubuntu, and other Linux servers.
Installation:
1. Dependent packages
- Cmake2.6 is the minimum version
- G ++/GCC4.3 is the minimum version
- Boost1.37 is the minimum version
- Flex
- Bison
- Re2c
- Libmysql
- Libxml2
- Libmcrypt
- Libicu4.2 is the minimum version
- OpenSSL
- Binutils
- Libcap
- GD
- Zlib
- TBBIntel's thread building blocks
- Oniguruma
- Libpcre
- Libexpat
- Libmemcached
The following package must be patched based on the source code
- Libcurl
- Src/third_party/libcurl. fb-changes.diff
- Libevent 1.4
- Src/third_party/libevent-1.4.13.fb-changes.diff or SRC/third_party/libevent-1.4.14.fb-changes.diff
Ii. Specify the cmake location
Export cmake_prefix_path =/home/user
Iii. Compilation
CD/home/user/dev
Git clone git: // github.com/facebook/hiphop-php.git
CD hiphop-PHP
Git submodule init
Git submodule update
Export hphp_home = 'pwd'
Export hphp_lib = 'pwd'/bin
Make
Cmake.
According to fackbook, the performance can be improved by about 50%, provided that PHP Code does not contain Eval, a rarely used method.
4. Use hphp
Environment Settings:
CD .. # enter the root directory of hphp and the directory where the source code is stored
Export hphp_home = 'pwd'
Export hphp_lib = 'pwd'/bin
# If you followed the Ubuntu 9.10 instructions, you also need
Export cmake_prefix_path = '/bin/pwd '/../
There are several modes
1: directly compile and execute C ++ code
Hphp/hphp test. php
2: Compile to a temporary folder and execute the compiled C ++ program.
Hphp/hphp test. php -- keep-tempdir = 1 -- log = 3
/Tmp/hphp_p6vssp/program based on your own running
3: Compile php as a service and run it on the specified port
Hphp/hphp test. php -- keep-tempdir = 1 -- log = 3
/Tmp/hphp_p6vssp/Program-M server-P 8080
Curl http: // localhost: 8080/test. php
Sudo/tmp/hphp_p6vssp/Program-M daemon
Refer:
Https://github.com/facebook/hiphop-php/wiki/Running-HipHop
Http://www.ooso.net/archives/557