how to install hiphop for php?

qweqwe qwe picture qweqwe qwe · Nov 15, 2011 · Viewed 7.7k times · Source

The most of devepolers know something about Facebook's Hiphop for php, I want to use it in my scripts but have no idea where to start.

Should I speak with my server provider? or Do I need to add some codes into my scripts?

Answer

Alasdair picture Alasdair · Nov 15, 2011

HipHop is very difficult to install, but luckily for you I've just been through it!

You need a dedicated server, easiest to install on Red Hat or CentOS, or Amazon Linux. You cannot install it on a shared host, you need root access.

It's also easier to install on a clean server (just the OS).

I recommend you get a clean Instance from Amazon Web Services and install it on that, you can turn it off whenever you don't need it. It's not expensive.

This will install it on an AWS Instance, put it into SSH one line at a time:

<!-- 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

Then every time you login to SSH, paste this:

<!-- 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

Oh, I should add that you will need HipHop installed on the server you want to run the compiled scripts on. So with all this considered, it's probably not what you want.