Posted By: The Channel 9 Team | Mar 16th, 2005 @ 3:12 PM | 51,320 Views | 28 Comments
Tomas Matousek and Ladislav Prosek talk about their PHP .NET compiler, Phalanger. These guys don't work at Microsoft, Charles Torre ran into them at a recent CLR compiler lab held on Microsoft's main campus. Very cool stuff. You can learn more on their Web site.
Media Downloads:
Rating:
0
0
ZippyV
ZippyV
Fired Up

Did those guys also make it possible to create PHP files in Visual Studio.net (with statement completion, intellimenus)?

rhm
rhm
I see. I was wondering what the point of it was - I mean it has the disadvantage of an old-fashioned execution model (php) with none of the advantage of php (being able to run on a free OS). If you're going to restrict yourself to running on Windows you'd be mad not to ASP.NET. And if you had a whole heap of PHP code you wanted to run you could just use PHP anyway which is available for Windows. I suppose being able to run PHP code faster could be useful to some people though.

I thought Zend was a compiler of sorts but I guess it interprets the bytecode it generates (like early JVMs) so it's still not as fast as a CLR based system.

I like the way people approach the CLR with "I wondered if it was possible to for it to run a dynamic language" - I've seen that from the developers of quite a few different projects before. Of course it's possible for the CLR to run any language at some level as it is a turing-complete machine even in verifyable mode. To run a dynamic langauge just means the compiler just has to throw out a lot more instructions to handle things like late binding and run-time type conversions. OK, the CLR isn't ideally suited to all langauges which means a langauge-specific runtime like most LISP implementation use would be faster, but the possibility to target the CLR is there for any language.
Charles
Charles
Welcome Change

Compiling it to managed means that you can interoperate with other managed languages really naturally. So, you can take a PHP project and add new "modules" to it that you write in, say, C#, then import the C# dll into your Phalanger project, and compile.

So, it's more than just performance (not to mention security), but, you are right, it was kind of a "let's see if we can do this" kind of thing (which many school projects are, initially) and they did! Smart kids (well, they look like kids to me).

C

Charles
Charles
Welcome Change
Nope. They made it possible to take existing PHP code (minus the unmanaged extensions, of course) and compile it to IL. The resulting code is Jitted and run on the managed heap. And it runs faster than the interpreted original. Why? Cuz it's compiled not interpeted.

Check out their site and ask them questions and give them feedback!

EDIT: From the authors' site:

Our integration introduces the PHP language into the VS.NET in a specific project type supporting syntax highlighting and compilation. PHP files are compiled to .NET Framework executables and can be executed and even traced from the VS.NET environment using the generated debug information.

To make script development and debugging more comfortable, the IntelliSense support for PHP projects and direct PHP variable insight may be added in future versions but this is not a priority for the current project. The VS.NET integration is rather some kind of add-on to the Phalanger.


C
PerfectPhase
PerfectPhase
"This is not war, this is pest control!" - Dalek to Cyberman
Haven't had time to watch all the videos yet, but is it possible to debug a php page in VS the same way you would an ASP.NET page?

Stephen
rjdohnert
rjdohnert
You will never know success until you know failure
Cool stuff, how long do you think it will take the mono guys to get this working with their stack.  I heard Miguel and Nat look at Channel 9 quite frequently.  Cool stuff though, they looked a little nervous but that happens on camera a lot if you arent used to it.  This could be used to help migrations from Linux or UNIX to Windows as well as several other uses.
rasx
rasx
Programmer/Analyst III, Emperor of String.Empty
It would be really, really great to generate some kind of binary that Apache servers can use running PHP. So we can build and test on our Windows box and "publish" to a non-IIS server!
Charles
Charles
Welcome Change
I can't talk about "Mono" but I can talk about the fact that Whidbey enables the emitting of pure IL from MC++ compilation...

C
Charles
Charles
Welcome Change
rhm wrote:
Of course it's possible for the CLR to run any language at some level as it is a turing-complete machine even in verifyable mode. 


?
Microsoft Communities