Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

If you use CentOS 5.4, it's more easier to install the entire needed packages via yum. Just have to install first the following repos:

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

Before installing, uninstall mysql and php

After installing those repos, you can install by simply typing:

yum install hiphop-php

I've read Amazon Linux is based on Fedora/CentOs, so could this works?

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

This git repo allows you to build a VM based on Debian/Ubuntu that has HipHop/HHVM installed:

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

The Vagrantfile contains a script that you can use on a VM or server. However, using the Vagrant VM first to see whether HipHop is going to work for you is highly recommended.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top