如何安装hiphop for php?

时间:2011-11-15 05:45:03

标签: php hiphop

大多数devepolers都知道Facebook的Hiphop for php,我想在我的脚本中使用它,但不知道从哪里开始。

我应该与服务器提供商交谈吗?或者我是否需要在脚本中添加一些代码?

4 个答案:

答案 0 :(得分:20)

HipHop很难安装,但幸运的是,我刚刚经历过它!

您需要一台专用服务器,最容易安装在Red Hat或CentOS或Amazon Linux上。您无法在共享主机上安装它,您需要root权限。

在干净的服务器(只是操作系统)上安装也更容易。

我建议您从Amazon Web Services获取一个干净的Instance并在其上安装,您可以在不需要时将其关闭。它并不昂贵。

这将把它安装在AWS实例上,一次将它放入SSH一行:

<!-- language: sh -->
sudo su -
export LDFLAGS="$LDFLAGS -lrt"
export CMAKE_PREFIX_PATH=/home/ec2-user/hiphop/local
export HPHP_HOME=/home/ec2-user/hiphop/hiphop-php
export HPHP_LIB=/home/ec2-user/hiphop/hiphop-php/bin
ldconfig
yum -y install git cmake boost pcre-devel libicu-devel libmcrypt-devel oniguruma-devel mysql-devel gd-devel boost-devel libxml2-devel libcap-devel binutils-devel flex bison expat-devel patch gcc gcc-c++ bzip2 bzip2-devel memcached openldap openldap-devel readline-devel libc-client-devel pam-devel
mkdir /home/ec2-user/hiphop
cd /home/ec2-user/hiphop
git clone git://github.com/facebook/hiphop-php.git
wget "http://downloads.sourceforge.net/project/re2c/re2c/0.13.5/re2c-0.13.5.tar.gz?use_mirror=cdnetworks-us-2"
wget "http://www.threadingbuildingblocks.org/uploads/77/142/2.2/tbb22_20090809oss_src.tgz"
wget http://curl.haxx.se/download/curl-7.20.0.tar.bz2
wget http://www.monkey.org/~provos/libevent-1.4.14-stable.tar.gz
wget http://launchpad.net/libmemcached/1.0/0.48/+download/libmemcached-0.48.tar.gz
tar xvjf curl-7.20.0.tar.bz2
tar xvzf libevent-1.4.14-stable.tar.gz
tar xvzf re2c-0.13.5.tar.gz
tar xvzf tbb22_20090809oss_src.tgz
tar xvzf libmemcached-0.48.tar.gz
export LDFLAGS="$LDFLAGS -lrt"
export CMAKE_PREFIX_PATH=/home/ec2-user/hiphop/local
cd /home/ec2-user/hiphop/tbb22_20090809oss
gmake
cp -Rp include/tbb/ /usr/include/
cp /home/ec2-user/hiphop/tbb22_20090809oss/build/*_release/*.so /usr/lib/
cp /home/ec2-user/hiphop/tbb22_20090809oss/build/*_release/*.so.2 /usr/lib/
ldconfig
cd /home/ec2-user/hiphop/re2c-0.13.5
./configure --prefix=/home/ec2-user/hiphop/local
make install
cd /home/ec2-user/hiphop/libevent-1.4.14-stable
cp /home/ec2-user/hiphop/hiphop-php/src/third_party/libevent-1.4.14.fb-changes.diff .
patch < libevent-1.4.14.fb-changes.diff
./configure --prefix=/home/ec2-user/hiphop/local
make install
cd /home/ec2-user/hiphop/curl-7.20.0
cp /home/ec2-user/hiphop/hiphop-php/src/third_party/libcurl.fb-changes.diff .
patch -p1 < libcurl.fb-changes.diff
./configure --prefix=/home/ec2-user/hiphop/local
make install
cd /home/ec2-user/hiphop/libmemcached-0.48
./configure --prefix=/home/ec2-user/hiphop/local
make install
cd /home/ec2-user/hiphop/hiphop-php
git submodule init
git submodule update
export HPHP_HOME=/home/ec2-user/hiphop/hiphop-php
export HPHP_LIB=/home/ec2-user/hiphop/hiphop-php/bin
cmake .
make
alias hphp=/home/ec2-user/hiphop/hiphop-php/src/hphp/hphp

然后每次登录SSH时都粘贴:

<!-- language: sh -->
sudo su -
cd /home/ec2-user
export LDFLAGS="$LDFLAGS -lrt"
export CMAKE_PREFIX_PATH=/home/ec2-user/hiphop/local
export HPHP_HOME=/home/ec2-user/hiphop/hiphop-php
export HPHP_LIB=/home/ec2-user/hiphop/hiphop-php/bin
ldconfig
alias hphp=/home/ec2-user/hiphop/hiphop-php/src/hphp/hphp

哦,我应该补充说,您需要在要运行编译脚本的服务器上安装HipHop。所以考虑到所有这些,它可能不是你想要的。

答案 1 :(得分:2)

如果您使用CentOS 5.4,通过yum安装整个所需的软件包会更容易。 只需先安装以下回购:

HPHP:

rpm -ivh http://pkg.tag1consulting.com/hphp/x86_64/hphp-release-1.0-2.el5.noarch.rpm

EPEL:

rpm -ivh http://epel.osuosl.org/5/x86_64/epel-release-5-4.noarch.rpm

IUS:

rpm -ivh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/ius-release-1.0-8.ius.el5.noarch.rpm

安装前,请卸载mysql和php

安装完这些仓库后,您只需输入以下命令即可安装:

yum install hiphop-php

答案 2 :(得分:0)

我读过亚马逊Linux是基于Fedora / CentOs的,所以这可行吗?

https://github.com/facebook/hiphop-php/wiki/Installing-or-Building-HipHop-PHP-via-RPM-on-CentOS-5

答案 3 :(得分:0)

这个git repo允许你构建一个基于安装了HipHop / HHVM的Debian / Ubuntu的虚拟机:

https://github.com/javer/hhvm-vagrant-vm

Vagrantfile包含可在VM或服务器上使用的脚本。但是,强烈建议首先使用Vagrant VM查看HipHop是否适合您。