February 3, 2010 | Developer

PHP is the programming language that runs many web applications, including WordPress. PHP’s slower than many other languages, but it’s fast to develop in.

Now Facebook, which also runs on PHP, has announced a new version of PHP that runs twice as fast.

This also means that if you have a popular WordPress blog, you might only have to have half the server size you use now.

How PHP Works

Turtle
PHP, in its usual incarnation, is an interpreted language. This means that a program (such as a PHP module in the Apache webserver) reads the PHP instructions in your script and executes them in turn. Every time the PHP script is executed, it has to be turned into machine code, even if the script runs 1000 times per hour. Obviously, this is inefficient, but people put up with it because PHP is considered easier to develop in than other languages.

Rabbit
By comparison, C++ is a language which is usually compiled (changed to machine instructions which run directly on the CPU). This happens only once, and every time the program runs, it runs directly on the processor. Because there’s no intermediate interpretation step, C++ programs run much faster.

Facebook’s HipHop PHP

Facebook announced what they are calling HipHop PHP, which translates PHP into C++. Then you use g++, the GNU C++ compiler, to compile the C++ program.

Here’s how the process works:

HipHop PHP Transformation Process

HipHop PHP Transformation Process

Facebook says compilation of their PHP code results in savings of 50% in server usage.

They also released HPHPi, which is an optimized PHP interpreter that doesn’t require you re-compile your code.

Download HipHop PHP

Facebook is going to release the code to HPHP under the PHP license on Github for download at this address (but it’s not there yet).

Caveats

In order to optimize PHP to the maximum, they left out some rarely used dynamic functionality, such as the eval() function.

I’ll report more on HipHop PHP as Facebook releases more information.

Resources

Facebook HipHop PHP announcement

HipHop release video

Facebook HipHop developer mailing list

ZDNet article

HipHop for PHP: Who Benefits?

BestTechie article

Feed2Meme article

Facebook’s HipHop Goes Public With a New PHP Runtime

PHPC: A PHP Compiler

Roadsend PHP compiler

An interview with a Facebook employee about PHP

PHP Facebook release


If you liked this article

If you liked this article, don’t forget to subscribe for updates!

Subscribe to New Articles by RSS or E-mail

Get updates by RSS (What’s RSS?)

Subscribe by email:

Follow me on Twitter

Top Incoming Search Terms

compiling hip hop php under windows download hiphop php compiler facebook announce compile php facebook hiphop for windows facebook hiphop wordpress facebook runs on php hip-hop php under windows hiphop for php "on windows" apche hiphop php compiler download hiphop php on mac hiphop php windows hiphop windows hiphop-php under mac hiphop-php windows hiphop-php wordpress how hiphop php works php hip hop for windows php hiphop php hiphop compiler windows php hiphop windows roadsend php compiler windows wordpress blogs

Related posts:

  1. How Facebook Runs PHP and MySQL I was surprised to know that Facebook runs on PHP....
  2. The Origins of Facebook, Hacked E-mails, and Privacy Facebook is one of the largest sites on the Internet....
  3. Back Up Gmail, Facebook, WordPress, and Other Social Media with Backupify These days many people prefer to have their applications in...
  4. How to Serve Your WordPress Blog from the Root Directory If It’s Installed in a Subdirectory If your blog is the main point of focus for...
  5. Firefox 3.1 Beta Has New, Faster TraceMonkey Javascript Engine InfoPackets reports that the Firefox 3.1 beta is getting faster...

Explore related content: , , , , , , ,

2 Responses to “Facebook Announces a Better, Faster PHP: HipHop PHP”

  1. Hey thanks for that interesting post.
    But I was having some problem with viewing some of the images in mozilla firefox.
    Is it the fault in my browser?

  2. Thanks for the insight.

Leave a Reply

CommentLuv Enabled