Archive for April, 2011

Mod_rewrite and HipHop for PHP on Apache Web Server

Monday, April 25th, 2011

PHP scripts compiled with HipHop for PHP compiler can easily act as HTTP servers. However, they do not provide the Internet’s most popular method for creating friendly URLs’, the mod_rewrite module that is supplied with the Apache Web server.

In this article I will describe the easiest way to run compiled PHP scripts from the Apache server. (more…)

How to install HipHop for PHP on CentOS 5.x

Friday, April 22nd, 2011

In one of my previous articles I described the installation process of HipHop for PHP compiler on Fedora system.

I’ve also mentioned that CentOS 5.5 had problems with this compiler.

In this article I’m going to show you how to overcome these difficulties and succesfully install HipHop for PHP on this system. (more…)

Strong data typing in PHP, part II: autoboxing and indestructable objects

Wednesday, April 13th, 2011

In an earlier article on the strong typing I’ve described the typehint mechanism that provides data type enforcement for the values sent to the methods and functions. Unfortunately said implementation does not protect against another problem associated with the dynamic typing of variables: a lack of type enforcement when overwritting value of an existing variable.

In order to control the type of data, I decided to introduce to PHP the concept of autoboxing known from other languages such as C# and Java. (more…)

HipHop for PHP: Benchmark – Revenge of PHP

Monday, April 4th, 2011

In previous article I measured the performance of HipHop for PHP by performing some tests downloaded from the website. Unfortunately the test list was incomplete.

Only six tests were selected to avoid potential incompatibility issues with the HipHop compiler (those incompatibilities can be found in the compilers’ documentation). Three other PHP scripts had problems reading from the STDIN (tests: the reverse-complement, regex-base, k-nucleotide), while the fourth one failed because of lack of support for the gmp library (pidigits test).

As requested by readers however, I present you the results of two consecutive tests: regex-dna and k-nucleotide.

HipHop for PHP: Benchmark

Saturday, April 2nd, 2011

Benchmark icon

There is a well known benchmark on the website comparing the performance of many different programming languages. While I am far from discussing the superiority of one language over another, I realized that it would be interesting to perform a little speed test between a … PHP and PHP (compiled with the help of HipHop for PHP).

I hope that test results presented below will be helpful in answering, how much faster is PHP after compilation, and whether the HipHop for PHP is actually as efficient as claimed by Facebook developers. (more…)