Not Your Daddy’s PHP

Back when .Net 2.0 was released, a few of the PHP developers we have on staff got a case of “framework envy.” For those of you who are not familiar with .Net 2.0, implementing it into your site is sort of like going from the brick mobile phones of the 1990’s to the 3GS smart phones dominating the market today. I’m sure you’ve all heard of Apple’s iPhone slogan, “There’s an app for that?” Well, .Net can take some creative license with that marketing gem; There’s a class for that.

So, what’s a poor PHP developer to do to eradicate framework envy? Well, the guys at Phalanger have a solution – they brought the .Net framework to PHP!

As we heard in the interview with Shaun Hirschman from Microsoft, the software giant is taking great strides to facilitate how things like PHP and MySQL run on the Windows Server OS (more information on the PHP on Windows campaign can be found on the Microsoft website). However, as we all know, larger corporations don’t always move at a speed that is fast enough for us. So, for those of you who have a Windows server, and want a more immediate fix, take a look at Phalanger. The Phalanger development team has worked very hard on getting PHP to run at the same speed as .NET, as well as incorporating much of the flexibility and control inherent in the .NET platform. For example, PHP .Net utilizes the .Net CLR to compile and run PHP, which means performance increases upwards of 50% over interpreted PHP, as well as native IIS support for PHP.

Another amazing feature of Phalanger is the ability to directly port PHP applications over from standard PHP to PHP .Net – potentially with very little, if any, code modifications. That includes porting popular existing PHP applications like PHPBB and PHPMyAdmin. It can even handle much of the components and extensions natively distributed with PHP.

So, someone will inevitably ask the question “why not just learn .NET?” And it’s a good question. The simple answer is time, or the lack thereof. It can take weeks, and even months, to learn a new language, much less a new development framework. Phalanaer bridges that gap in knowledge and allows PHP programmers to basically use the language they’re most familiar with but still take advantage of the benefits of a brand new framework. A good example of this is moving from a web application to a desktop application. With C# (a popular .NET language) you can easily go from the web to the desktop. With PHP? Not so much. To ease that pain, the amazing guys at Phalanger developed an extension for Visual Studio 2008 Professional or higher (NOTE:  Express editions DO NOT support extensions) that gives Visual Studio complete support, including beta support for Intellisense and Windows forms and console support, for PHP .Net.

So, it sounds too good to be true, huh? Well, not entirely, but there are some things to consider before completely buying into Phalanger and PHP.net:

  • While it is stable, and there are an increasing amount of user tutorials and great resources, there isn’t any major corporation, such as Zend or Microsoft backing it. This can be dangerous simply because no one is financially invested in keeping the project going.
  • As we are now in the heady days of .Net 4.0, Phalanger has just finished porting the .Net 2.0 framework. Remember, this is an open source project from students at Charles University, Prague. As such, there is some lag between when Microsoft releases an update and when Phalanger can adopt the same improvements (Railo has a similar issue with ColdFusion).

Okay, two potential issues in an otherwise very ambitious project – one that is to the great benefit of developers around the world. Is Phalanger and PHP.Net ready for “Prime Time?” The answer is open to debate…so let’s debate! Are you familiar with Phalanger? If so, what are your thoughts? We’d love to hear them.

[NOTE: a huge thanks goes out to Kevin Sugihara, who started this post. While I get the byline, Kevin deserves the credit for the idea of the post and the great information it contains. Thanks, Sugi! – Derek]

VN:F [1.9.1_1087]
Rating: +2 (from 2 votes)
Share So Others Can Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • FriendFeed
  • LinkedIn
  • MySpace
  • StumbleUpon
  • Technorati
  • Twitter
  • Tumblr

4 Responses to “Not Your Daddy’s PHP”

  1. Nothing wrong with doing new things, but as for me personally, I got into PHP not so I could bind myself to Microsoft, but to get free of it. PHP/mySQL is my first step, then CentOS from there.

    On the other hand, if there’s a business reason to use .NET, it’s nice to see you don’t have to necessarily switch to a whole new programming language to do it efficiently.

    VA:F [1.9.1_1087]
    Rating: +1 (from 1 vote)
  2. PHP is ok, but why use it when you can use Visual Basic Syntax if your just learning? I mean the curly braces suck compared to english like syntax. And, I don’t trust that PHP will always be here in the form it is. Look at ASP. I used to do loads of work with classic ASP and it was good, but Dot Net is so much faster, and better in so many ways I can’t even tell you how much I like it better. IIS and Dot Net rulz..
    Tim

    VA:F [1.9.1_1087]
    Rating: +1 (from 1 vote)
  3. Tim – the beauty is, regardless of your preference, Windows can accommodate it. The PHP vs. .NET argument will be ongoing, just as the Linux vs. Windows debate will long outlast me. However, at least you can code PHP reasonably well on Windows – can’t say the same for .NET on Linux (though people are trying…).

    VN:F [1.9.1_1087]
    Rating: 0 (from 0 votes)
  4. I think Phalanger is a great idea. I tried it out with a few scripts I developed and some open source ones too, and most of them worked fine. But it needs a little more work to be considered ready for “Prime Time”. And I can’t wait for it to become so. At least I will start developing in one language instead of comparing the pros and cons of PHP and C# with a client every time I start a new project.

    VA:F [1.9.1_1087]
    Rating: 0 (from 0 votes)

Leave a Reply