PHP Sharp

Be warned. Reading this may give you cause to choke on your turkey leftovers.

A couple of years ago, Alan Knowles did some experimenting with getting PHP to run under .NET. He documented his expierences here. Alan managed to put together a working PHP compiler and reached the “Hello World” stage, I believe. Of course there’s a long way to go from Hello World to something that’s actually useful, such as how to implement PHP’s function library. Things that make you think only the insane would want to attempt.

Well it turns out a group of Czech programmers were insane enough to do it – meet Phalanger, a PHP compiler for .NET.

From a little messing around, the basics work. Here’s the output from phpinfo();

They also seem to have implemented some of the better known PHP extensions like GD and PDF. From the Overview.

The principal goal of our project is to enable full functionality of existing PHP scripts without any modification.

Not sure how I feel about Phalanger yet. Two key phrases from the license, which stuck out;

You may use this Software for any non-commercial purpose

You may not reverse engineer, decompile, or disassemble the Software

Also failed to find any mention of Mono. Given that the source is unavailable, running Phalanger under Mono on *Nix is not an option right now.

At the same time, having access to the .NET library including those ASP.NET controls is a tempting prospect…

Anyway, something to experiment with.