Windows Phone 7 Developer Launch - Learn More
kick it on DotNetKicks.com   Shout it  

PHP vs ASP.NET Rebuttal

I should just ignore people sometimes, but today I couldn’t help it. I read this post which claims to compare PHP to ASP.NET. I don’t really care if someone likes one more than the other, but really this post didn’t back up any claims and was full of false statements. I may get a few things wrong here as well, but I want to just set the record straight.

(Disclaimer: I am an ASP.NET developer). This article is obviously biased and provides no support for its claims:

1. PHP is an Open Source Language

This is true. ASP.NET is proprietary. Wither this is a pro or a con is a matter of opinion and for you to decide. I am ambivalent on this point. But I will add that last year the ASP.NET MVC Framework was released and with it comes the license to fork it and modify it to your hearts content. That is if it isn’t already flexible enough for you. Yes, MVC is built on a proprietary framework, but there is already an open source project which extends and replaces much of the default functionality.

2. PHP is Free

All the operations mentioned (Binary file, FTP/HTTP communication, encrypt passwords using MD5, send email) can all be done either natively from the .NET Framework, free open source alternatives are available or you can extend the framework to do it yourself. There is a broad community around .NET where you can find out how in either blogs or forums.

 

3. PHP is Flexible

ASP.NET can connect to all the database platforms mentioned. The choice of which is up to you - there is no requirement to use MS-SQL and many hosting providers allow you to chose between MS-SQL and MySQL. And about the performance degrade - prove it.

4. PHP is Portable

MONO exists as a port of .NET, including ASP.NET I remember reading about possible performance issues due to garbage collection and that it was in the process of being address. But I haven’t used it so I can’t really argue this point. However, I’m guessing the author hasn’t verified this either.

5. PHP has very familiar and well known Syntax

This point makes it painfully obvious the author has never used ASP.NET. He mentions the similarities in syntax between PHP and C++ as an advantage over ASP.NET. He then implies that this makes it easy to learn. Guess what C# is also similar to C++. Plus, ASP.NET doesn’t force you use C#. You can also use VB.NET, IronPython, Delphi and other languages for ASP.NET – so you can choose the language and syntax that suits you best.

6. PHP has less Code Complexity

This is a rehash of #5, but at least acknowledges the existence of VB.NET and C#. I’ll acknowledge the point that to create a new ASP.NET site vs a new PHP site you can fire up a text editor dump some code into a single file and you’ll be off and running. An ASP.NET site on the other hand requires a complex web.config file, global.asax, code-behind files for each .aspx page (optional) and a bin directory for compiled code. So for your basic small site or “hello world” example PHP is simpler. I’ll admit to never using PHP, but I started with classic ASP and they are similar enough for me to know that once you start building a larger site the complexity increases exponentially. Include files (a primary means of code-reuse for interpreted web languages), debugging and the lack of compile-time checks greatly hampers developing when using an interpreted script language (which is the case for PHP).

CORRECTION: Thanks to Jason Bunting for pointing out that I was wrong – an ASP.NET site requires nothing more than a single .aspx file. I guess I rely a little too much on the Visual Studio IDE sometimes. So again, PHP does not win on simplicity here either. I’ll leave in the incorrect info above along with this correction.

7. PHP is Fast

I’d like to ask the author again, back it up. While I don’t normally put much stock in benchmarks, for the sake of this discussion I will at least provide 2 examples I quickly found online (that weren’t done by M$).

Nile benchmark by PCMag

Wrensoft benchmark

Benchmarks often depend on what you’re doing, but I’ll go out on a limb and say that most often compiled code beats interpreted script hands down. I’ve heard of 3rd party commercial products (something the author is apparently against) which will pre-compile PHP code so this could be something that helps PHP, but I’ll venture a guess that these run as native code once compiled instead of from the PHP interpreter.

8. Free Webhosting

The author is correct. I don’t know of any free ASP.NET hosting providers. But remember the adage, “You get what you pay for”. I’m all for free, but when it comes to web hosting, I wouldn’t ever bank on a free provider for anything other than my personal family web site. Free hosting for an e-commerce app? Not on your life.

9. PHP has Free Tools and Libraries

Ever heard of Visual Studio Express Editions? They are free and I’d have to say I’ve never used an IDE better than Visual Studio – even the express editions. That’s my personal opinion and you may not like Visual Studio, but there is still a free edition that includes debugging with edit-and-continue support as well as refactoring. And there are plenty of open source libraries written for .NET – try CodePlex.com over 10,000 open source projects on that site alone.

10. Code Compaction

First of all this is a ridiculous argument. It really depends on what you’re doing. There are things that can be done very tersely in both languages and obviously he’s never written a line of C#. But if something isn’t terse enough for you, you can write your own code that will (if someone hasn’t already done it for you on the internet) and reuse it anywhere you like. This is all PHP is, a library of objects and functions, in .NET you can write anything that doesn’t already exist. As for the author’s specific example, the model binding in ASP.NET MVC Framework allows for simple and very complex binding of GET and POST variables from scalar values to collections of complex objects – all strongly typed for you – no need for the ASP Request object.

11. PHP is Light Weighted Language

Again, for small projects absolutely he’s right because of the basic files required for an ASP.NET project I mentioned above. But take two large and complex sites and it really depends on what you’re doing and how you’re doing it. You can write bloated code in any language – I guarantee it.

12. Security

I won’t argue the comparison of Apache and IIS. I’ll concede this, but I bet there’s a lot of insecure PHP applications out there which are just as vulnerable to SQL Injection and XSS as any ASP.NET application. But if you ignore the web server (I know I’m asking a lot here – seriously) by default, there are more protections in ASP.NET than PHP. As an example, if you just lazily dump together an ASP.NET application and one in PHP, ASP.NET request validation forces you explicitly allow HTML tags in POST variables before it will let them be submitted my a user.

13. Architecture

You’ve got to be kidding me! This guy really has never been anywhere near ASP.NET. He’s claiming that the parsing engine runs in a different process space than the ASP.NET Engine!?! First of all, as of IIS 7.0 ASP.NET no longer runs in a separate process space from IIS – it’s integrated. But even if you were running in classic mode or a version of IIS previous to 7.0, IIS passes off a request to the ASP.NET engine which then handles the entire job in its own process and then sends the raw response back to IIS to be streamed (no parsing or anything required) back to the client.

14. PHP/MYSQL combination is more efficient that ASP.NET/SQLSERVER combination

See my link to the PCMag benchmark above, nuff said.

15. PHP Website can be hosted on any Sever very efficiently

It does cost more to host an ASP.NET application, true story. And w/o Mono you can’t host it anywhere but Windows. But if you want to take your application elsewhere for better service and uptime – you’re free to do it and with no more pain than any other platform. But yes, add the requirement for Linux and well that just doesn’t fly as well.

16. PHP is easy to learn

Did the author have some kind of quota to fill? See #5 and #6. Oh and again, VB isn’t the only language you can use to write ASP.NET. It isn’t even the most widely used – C# is use by far more ASP.NET developers than VB.NET – I can count the latter that I know personally on one hand.

17. PHP is easily debuggable [sic]

Are we talking about debugging PHP itself or your web application written in PHP? If we are talking about the former, then yes don’t count on getting a fix when there’s a problem anytime soon unless you’re a paying customer. But the entire source code for the .NET Framework is available for debugging purposes and BTW the Visual Studio debugger is one of the most advanced there is. So if we’re talking about the latter, don’t even bother because not only is VS equipped with deep debugging support, but the next version even has more advanced support for multi-threaded debugging than before.

Which brings up a side point – what kind of support does PHP have for multi-threading, something very important to applications which require intensive calculations? Also ASP.NET provides support for asynchronous requests, something entirely different than multi-threaded operations. To improve scalability, you can free up threads on blocking operations (File I/O, network and database calls, etc) by using asynchronous calls. This allows your current thread to be used elsewhere until your blocking call returns – a big plus when you’re in need of a lot of throughput for a high traffic web site.

18. Database Support

Here we are with the quota-filling again. ASP.NET can connect to every database that PHP can.

19. PHP has so many free built-in functionalities

Deja vu! See #2 – all this stuff is available, natively, from open source or you can roll your own if you don’t like what’s available.

20. PHP is Popular

I don’t know which has more (because the author didn’t bother to back up his statement with any recent surveys), but I do know that I have unlimited resources on ASP.NET for which I never have to look far to find answers I need. There are plenty of jobs as well. And in my purely anecdotal experience the jobs I see pay better for ASP.NET.

21. PHP is easily available

Rudux of #20! This guy was really trying to stretch to meet his quota.

Conclusion

I resubmit that the author made no real comparison between PHP and ASP.NET. I have not attempted to either, because I freely admit I do not have the experience with PHP to make a fair comparison. I have rarely seen such a biased, unsupported post. I am fine if others like PHP better than ASP.NET but at least get your facts straight. If you want to know the advantages of PHP talk to someone who knows it, same goes for ASP.NET but don’t fall for lazy stuff like this.

Tags: ,

kick it on DotNetKicks.com   Shout it  

Feedback

# re: PHP vs ASP.NET Rebuttal

Gravatar Amen to that one.
I posted a response on his blog in a similar vein albeit a lot harsher and it was unceremoniously removed.
I guess he didn't like the criticism.... 9/11/2009 3:11 PM | Simon.G

# re: PHP vs ASP.NET Rebuttal

Gravatar I have a good friend who has been a PHP developer for 5 - 6 years. I once asked him if there was a debugger for PHP. His response? "What's a debugger?" Seriously. 9/11/2009 3:50 PM | Jared W.

# re: PHP vs ASP.NET Rebuttal

Gravatar Mark, you are both wrong on a few things, but it is late and I don't have the time - so I will correct just one thing: in #6 you allude to how complex an ASP.NET website is to get setup. Patently false. You do not need a web.config file, you do not need a global.asax file, etc. Here is a valid ASP.NET page that will work all by itself:

<%@ Page Language="C#" AutoEventWireup="true" %>
<script runat="server">
public void Page_Load(object sender, EventArgs e) {
if(IsPostBack){
m_Test.Enabled = false;
}
}
</script>
<html>
<body>
<form id="form1" runat="server">
<asp:Button id="m_Test" runat="server" Text="Click Me" />
</form>
</body>
</html>

I don't know if your comment form will handle it, but you get the idea.

Also, you really need to do a spelling and grammar check before publishing! :)

Ciao! 9/12/2009 12:44 AM | Jason Bunting

# re: PHP vs ASP.NET Rebuttal

Gravatar Glad someone had the energy to challenge that ridiculous article. As a php dev, I don't think the author knew anything about php let alone asp.net 9/12/2009 4:17 AM | Rob

# PHP Has Very Familiar and Well-Known Syntax... NOT!

Gravatar Regarding point #5, that "PHP has a very familiar and well-known syntax." Syntax, yes. PHP does feel similar to C++, but after you take function names into consideration, there is nothing "familiar" or "well-known" about PHP. Well, unless you've coded considerably in the original C libraries which most of PHP's extensions are wrapping.

I am saying this as a developer that works exclusively in PHP, so obviously there is still a lot to love about the language. 9/12/2009 7:56 AM | Brian Reich

# re: PHP vs ASP.NET Rebuttal

Gravatar Yeah, I posted a response as well in a similar tone and was ignored/removed. It almost seems like the author was confused what the difference between ASP and ASP.NET is. 9/12/2009 12:18 PM | Jason Bentley

# re: PHP vs ASP.NET Rebuttal

Gravatar I use both, and really when php have a IDE like asp.net has, the maybe talk pear to pear. But Netbean and the eclipse plugins arent really an IDE 9/12/2009 2:34 PM | Chocolim

# re: PHP vs ASP.NET Rebuttal

Gravatar There are two debuggers for PHP. The code is so straight forward that many developers never use the debugger.

Regarding IDEs Zend's product is pretty good.

9/13/2009 3:32 PM | Derek Williams

# re: PHP vs ASP.NET Rebuttal

Gravatar Is he a troll? I read his post and was laughing. I've read many PHP vs ASP posts but none are as poorly written as that with as much duplicated and flat out false information. He sounds like a propaganda machine for a certain southern african country... 9/14/2009 7:55 AM | John Oxley

# re: PHP vs ASP.NET Rebuttal

Gravatar Jason - thanks for pointing that out. I've never actually tried to create an ASP.NET site w/o Visual Studio something easily attributed to laziness. So score another point for simplicity to ASP.NET! Feel free to correct anything else when you have the time putting myself out like this is what gives me more opportunities to learn.

Derek - PHP code may be straightforward, but I doubt PHP developers are so superior to developers in all other languages that they don't require a debugger for their *own* code. 9/14/2009 8:55 AM | MarkJMiller

# re: PHP vs ASP.NET Rebuttal

Gravatar Mark - thank you for pointing out what I really intended my correction to be about: the potential simplicity of ASP.NET. I think that it is easy to have tunnel vision about the ASP.NET framework as a whole when one works in Visual Studio all the time, because it defaults to setting all of those things up.

That guy's article comparing PHP and ASP.NET was written so poorly that I am surprised PHP fans aren't up in arms at such a horribly composed treatise on the strengths and weaknesses of PHP. I am sure someone with more intelligence could've done a better job, and I am sure it would've been more balanced. People that are so polarized about their opinions are usually that way because of inexperience; when it boils down to it, development platforms tend to have more in common with each other than significant differences. 9/14/2009 10:34 AM | Jason Bunting

# re: PHP vs ASP.NET Rebuttal

Gravatar Oh, last thing - I left a comment on that guy's post, though I doubt he will approve it.

The thing that bothered me most about his post, besides the obvious problems of grammar and redundancy, was the lack of relevant citations; how would a reader know he is not simply fabricating the claims he points out? I wish all readers of blog posts were critical of what they read, but most of us don't give it a second thought, especially when the views expressed are congruent with our own. 9/14/2009 10:39 AM | Jason Bunting

# re: PHP vs ASP.NET Rebuttal

Gravatar Jason, that was the whole reason behind my post - to stand as a correction against such blatantly false statements. I really think he's been sufficiently blasted for it too. I originally found the link on DZone.com and there about as many comments there as there are here on my blog. I never bothered posting a comment on his blog since I figured I would either get deleted or never get approved. I tend to let my mistakes stand. Unless comments are outright offensive I'll let them stand on my blog even if they make me look bad. Like I said, when I make a mistake it is an opportunity for me to learn from it. 9/14/2009 11:34 AM | MarkJMiller

# PHP vs ASP.NET Rebuttal

Gravatar PHP vs ASP.NET Rebuttal 9/30/2009 7:15 AM | Pingback/TrackBack

# re: PHP vs ASP.NET Rebuttal

Gravatar " I rely a little too much on the Visual Studio IDE sometimes" that pretty much sums it up for me.

10/6/2009 3:31 AM | jonny faifull

# re: PHP vs ASP.NET Rebuttal

Gravatar I used to love developing in .NET with webforms until I started working on some PHP projects. Then I realized that webforms are just a pain for the type of sites I create. They do have their place though. I enjoy ASP .NET MVC because as John pointed out I get control over the entire request life cycle.Thanks 12/11/2009 3:09 AM | Texas Hold'Em players

# re: PHP vs ASP.NET Rebuttal

Gravatar I'm no PHP developer, but when I began programming, I picked up developing quicker in an IDE and a debugger than I ever did functionally without a debugger.

In context, ASP.NET is much more accessible, yet powerful enough to do almost any programming task within the confines IIS and Windows.

Since I don't use any other OS to Windows, I may be bias in that case, but to me, the difference between PHP and ASP.NET is like the difference between a spade and a JCB digger 12/21/2009 7:40 AM | Shaunny

# re: PHP vs ASP.NET Rebuttal

Gravatar I must admit, great stuff! 1/4/2010 11:55 AM | Web design service

# re: PHP vs ASP.NET Rebuttal

Gravatar When on a Windows box, I use .Net. On Linux servers, I use PHP. In rare case where it's available, I use a Java web framework. Use what you're comfortable with (or curious about) until the next wiz-bang language comes out. Neither ASP or PHP are going the way of the Betamax. 2/9/2010 4:00 AM | Crapsspiel

# ASP.Net Script Installation Service

Gravatar If you have a website and you don't have the technical knowledge of installing the scripts you want on it, then you don't have to worry. We offer cheap, professional and fast script installation service. 1/3/2013 5:25 AM | ASP.Net Script Installation Service

# website malware removal

Gravatar Look at my web page ; www.developmentalmadness.com/.../...-rebuttal.aspx 2/11/2013 4:28 AM | website malware removal

Comments have been closed on this topic.
 

 

Copyright © Mark J. Miller