Building Pressflow with HipHop PHP on Ubuntu 9.10

These instructions are only known to work on 64-bit systems.

Setting up HipHop PHP

  1. Install git and build dependencies:
  2. sudo apt-get install cmake g++ libboost-dev flex bison re2c libmysqlclient-dev libxml2-dev \
    libmcrypt-dev libicu-dev openssl binutils-dev libcap-dev libgd2-xpm-dev zlib1g-dev libtbb-dev \
    libonig-dev libpcre3-dev distcc git-core dpkg-dev debhelper autotools-dev autoconf libtool \
    libcurl4-openssl-dev libboost-program-options-dev libboost-filesystem-dev libboost-system-dev
  3. Create a working directory:

    mkdir hiphop
    cd hiphop
    export HIPHOP=`pwd`
  4. Get the source:

    git clone git://
    cd hiphop-php
    git submodule init
    git submodule update
    cd ..
  5. Get and build the patched libevent:

    tar xzf libevent-*-stable.tar.gz
    cd libevent-1.4.13-stable
    cp ../hiphop-php/src/third_party/libevent.fb-changes.diff .
    patch < libevent.fb-changes.diff
    make install prefix=$HIPHOP
    cd ..
  6. Get and build libicu 4.2:

    tar xzf icu4c-*-src.tgz
    cd icu/source
    make install prefix=$HIPHOP
    cd ../../
  7. Get and build the patched curl:

    tar xzf curl-*.tar.gz
    cd curl-7.20.0
    cp ../hiphop-php/src/third_party/libcurl.fb-changes.diff .
    patch -p1 < libcurl.fb-changes.diff
    make install prefix=$HIPHOP
    cd ..
  8. Build HipHop:

    cd hiphop-php
    export HPHP_HOME=`pwd`
    export HPHP_LIB=`pwd`/lib
  1. cmake .

    * If cmake fails, run the following to empty the cache before trying again:

    rm CMakeCache.txt
  2. Test HipHop.
    1. From the shell:

      cd ..
      echo "Hello, world." > test.php
      hiphop-php/src/hphp/hphp test.php --keep-tempdir=1 --log=3 --output-dir=$HIPHOP/test-build
      test-build/program -m server -p 8080
    2. From a browser or other HTTP client, visit http://localhost:8080/test.php
    3. Output should consist of "Hello, world."
    4. From the shell, press Ctrl-C.

Building Pressflow

These directions are a work in progress.

  1. Install Bazaar:

    sudo apt-get install bzr
  2. Go into the HipHop directory:

    cd $HIPHOP
    mkdir pressflow-build
  3. Check out Pressflow from the Hip Hop compatibility branch and make it the working directory:

    bzr checkout lp:pressflow/6.x-hiphop
    cd 6.x-hiphop
  4. Generate includes:

    find . -name "*.php" > ../pressflow-build/files.list
    find . -name "*.inc" | grep -v "\.pgsql\.inc" | grep -v "\.mysql\.inc" >> ../pressflow-build/files.list
    find . -name "*.module" >> ../pressflow-build/files.list
    find . -name "*.install" >> ../pressflow-build/files.list
    find . -name "*.profile" >> ../pressflow-build/files.list
  5. Build the system:

    $HIPHOP/hiphop-php/src/hphp/hphp --input-list=$HIPHOP/pressflow-build/files.list --keep-tempdir=1 \
    --log=3 --include-path="." --force=1 -v "AllDynamic=true" --output-dir=$HIPHOP/pressflow-build
  6. Fix everything, rebuild.
  7. Launch the server:

    ../pressflow-build/program -m server -p 8080 -v "Server.SourceRoot=`pwd`" -v "Server.DefaultDocument=index.php" -c $HIPHOP/hiphop-php/bin/mime.hdf


The basis for dependencies and the build above is the "Building and installing" page posted to the GitHub wiki for Hip Hop PHP.