PHP is my favorite language, bare none. It’s simple, elegant, and fun to use. Problem is, for highly trafficked sites it’s a touch slow and can be quite memory hungry. If you’re Facebook this can lead to problems, which is why they invented Hip Hop PHP (HPHP), a collection of tools and technology that turns our slow and hungry PHP code into lean and mean C++.
Ok, So Just How Fast Is It?
As a quick comparison I created a simple FormBoss form and ran Apache Bench (ab from the command line), to get a sense of the speed difference between Apache 2.2 and HPHP.
The top two tests are when running our simple .php files, the bottom test is when serving a simple 62 byte .xml file with 100 concurrent users:
**It’s important to note these numbers will be lower when running though a network and calling a database. Also, while other servers like Cherokee can be twice as fast as Apache, HPHP is still nearly twice as fast again.
So yes, qualifications aside, HPHP is very fast indeed.
Sure these numbers are fantastic, but using HPHP means compiling the source from scratch and then using a series of command-line switches to run and manage the compiled PHP code.
No longer–In my spare time I’ve created and now released an open-source front-end UI to HPHP.
Read on to learn more, or just download the files!
A quick bit of history and why we need Aesop
Back in early 2010 Facebook announced a wonderful new technology called Hip Hop PHP (HPHP). The idea was simple: PHP is a fantastic scripting language, but its loosely typed roots and interpreted nature make it a good deal slower and memory hungry than other web technologies. As Facebook was already deeply invested in the PHP they didn’t want to give it up with out a fight. Thus, why not write a series of tools and applications that turn PHP into native C++?
That’s what they did of course, and apparently for an entity like FaceBook the savings are well worth it. That doesn’t mean that we can’t enjoy it as well, because along with the announcement that a large percentage of FaceBook’s traffic was already being server via HPHP, they were also releasing the whole mess as open-source software.
Bravo of course, what a fantastically nice thing to do. The only issue was that in order to get Hip Hop to run we need to compile it from source, then issue a series of command-line instructions to compile and run our applications. This isn’t the end of the world of course, but often times when trying to compile existing PHP source we’ll run into a bevy of errors and issues — not HPHP’s fault, but the existing PHP sources’. Thus, it’s a load of trial and error at first, which considerably diminishes the fun this type of work should be.
Nonsense I said, we can fix that. Lets create an application that removes the burden of working with the command line so we can instead focus on our code.
The Aesop UI
I was rightly excited when HPHP project was first released, and so even though it took me longer than I had wanted to start this project, I finally present a UI to HPHP.
The idea of course is to make the process of managing and using HPHP simple and possibly even fun, but above all useful.
To that end Aesop consists of three main functions and goals:
Pre-compile and package HPHP - The idea here is simple. To get us up and running as quickly as possible I’ve packaged the HPHP binaries in the full download version of Aesop. This means we no longer have to worry about compiling HPHP, which saves time and possible headache. We needn’t use this version though, we can still download a minimal, Aesop only version complete with full source code.
Compile – Compiling HPHP applications from the command line means well, using a command line, setting environmental variables, and so on. Thus, we remove this burden and instead focus on making sure our code-base is acceptable to HPHP.
Aesop builds the file lists HPHP requires for code-compilation, sets environment variables, displays errors, and also manages the results of HPHP for the other main function of Aesop…
Manage Servers – Compiling code is only half the story. Once compiled HPHP has literally created a server-in-a-box for us. It’s a single executable that contains your source converted to C++, a web server, and the full PHP run-time. Aesop manages these executable for us in a nice list format, allowing us to start, stop and delete them at will. Of course setting their properties using GUI controls or a more advanced interface to a so-called HDF file is included as well.
Who is this good for?
I would imagine the first group will be the tinker-types like me who are curious to see what all the fuss is about. My true hope however, is that after a while we can turn this into a true production-level appliance. This means anyone who needs the highest performance PHP stack possible.
To that end there are a few issues still on the table as of the first release:
- Even easier installation (e.g. packages for DEB and RPM)
- Static binding of the Qt libraries version.
- More robust process management for the compiler fork.
- A full command line interface for running headless.
- Support for HPHi
- Better support (more GUI options) for ./hphp
- Better support for Fedora
So yes I, (we) have work to do, but I think even as is the application provides an improved experience over the command line.
So what are the requirements, how do we get it, run it, and provide feedback?
Requirements
a) 64-bit Linux. HPHP requires a 64-bit OS, which in turn means Aesop was built for 64-bit as well. Also, HPHP requires several dependencies which are shown below in apt-get format. Fedora/Red Hat users will need to change the command to match your distro’s naming conventions and package names (e.g. yum install [...]).
b) The Qt 4 Libraries. Instructions for getting them are below.
Getting It
Download the files from the FormBoss Open Source page right here.
Please note we have two versions: The small one is just the Aesop source code, the large one is the Aesop source and a pre-compiled version of HPHP. Most users will want the full (large) version, as everything is packaged up and ready to be run. If however, you already have a compiled version of HPHP you may just want the smaller, source only download.
Running It
In the main download directory file we’ll find ‘Docs/Instructions.txt‘ file with full details. The short version however:
a) For Ubuntu we’ll run the following command to install HPHP’s dependencies:
sudo apt-get install git-core cmake g++ libboost-dev libmysqlclient-dev libxml2-dev libmcrypt-dev libicu-dev openssl binutils-dev libcap-dev libgd2-xpm-dev zlib1g-dev libtbb-dev libonig-dev libpcre3-dev autoconf libtool libcurl4-openssl-dev libboost-system-dev libboost-program-options-dev libboost-filesystem-dev wget memcached libreadline-dev libncurses-dev libmemcached-dev libicu-dev libbz2-dev libc-client2007e-dev php5-mcrypt php5-imagick
Fedora users need to install the same packages, but will need to use yum install and modify the names of some packages to match your distributions naming conventions. This link has some solid tips on doing so.
b) Open the Ubuntu Software Center and search for and install Qt Creator. This installs the Qt Libraries we need to run Aesop. Word is the Qt libs will be installed by default in Ubuntu 11.04. In any case, this also installs the most excellent Qt Creator and SDK, which means you may be that much more likely to contribute to this project in some way…
Fedora users will need to download Qt directly from Nokia’s site.
c) Extract the program files:
> For the full download (Aesop.tar.gz), simply extract the whole archive to your /Documents directory.
> Extract and place One-level up from where we’ve installed HPHP if you’ve downloaded the Aesop only archive (Aesop+Source.tar.gz).
d) Make sure Run-Aesop.sh is executable. Right click and under Permissions > Allow executing of file as program.
e) Double-click Run-Aesop.sh. The application should start, provided we’ve installed the Qt 4 Libraries.
f) We can also run Aesop in root mode by double clicking Run-Aesop-As-Root.sh and then selecting ‘Run in Terminal‘. This is for sites that require port 80 to run.
g) We can test out a sample strait away under the second tab: Run Compiled Code > Sample
Providing Feedback
This is what I’m most interested in : ) Drop a comment on this post and I’ll be happy to provide any help and feedback I can.
Code Limitations
HPHP is quite versatile, though we do need to be aware of a few HPHP limitations:
- The MySQLi and MSSQL extensions are not supported. We must use the PDO or MySQL. That said, compiled code can have calls that refer to those drivers (such as in a database class file), just don’t call any functions of those extensions and we’re fine.
- FTP and a few other extensions are not supported. See here for more.
- PHP 5.3 is not currently supported.
- Any code with eval() is not supported. This means, for example, that phpBB 3 is not going to work. It compiles…it just doesn’t run.
Finally…
I created this app in my spare time, quite literally during unit testing for the FormBoss Build 700 release. Aesop is hearty but by no means bug-free. I would love to see this situation resolved by anyone looking to work their own magic with the source!

Matt
July 14th, 2011
Downloads links were down for a while, but back up again.
Burkhard
February 6th, 2012
When trying to compile code, I get this error:
/home/[]myuser/Documents/Aesop/Aesop/../dev/hiphop-php/src/hphp/hphp: error while loading shared libraries: libboost_system.so.1.42.0: cannot open shared object file: No such file or directory
Compiler Process Finished. Status Code: 127
grdinic
February 6th, 2012
Greetings, and thank you for trying Aesop!
So it sounds like we may need to install the boost libraries. If you check in the Docs folder we’ll find a instructions.txt file that shows the installation command we need to do so. For example, for Mint we use:
sudo apt-get install libboost-system-dev libboost-program-options-dev libboost-filesystem-devMy guess is we do that and we should now have the proper library files. That said, it could be that boost now has a newer library, which means the 1.4.2 version used to compile is no longer valid. If this is the case we’ll need to install the entire Aesop program and HPHP binaries from source. Not fun I know, but again, instructions for doing so are included in the docs.
Good luck,
-Matt
Burkhard
February 7th, 2012
There were loads of other dependency problems (I tried shutting my eyes and installed on Ubuntu 11.10 (I know!)). Ended up building HipHop myself. Not fun, but now it works and I’m a happy bunny.
grdinic
February 7th, 2012
That’s most certainly the trick with HPHP: I try and build and test it for the most common distributions, but even that seems to have a bit of a fudge factor, in that that while it may work on my setup at the time, an update to Ubuntu down the road may render the proper version unusable.
Alas building HPHP from scratch isn’t too bad so long as we follow the directions on the Wiki.