Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have worked extensively in developing web applications using PHP and ASP.NET, but one of the questions that I'm constantly asked by customers is whether to move forward with a php website or an asp.net website.

So naturally the first thing that comes to mind is to answer the question like this:

PHP is open-source and ASP.NET is from Microsoft.

Usually after something like that is said the customer has a blank look on there face. Apparently the fact that one is open source and the other isn't doesn't really faze them. And for good reason, because when I first heard it, it really doesn't tell me much.

I know from working with both that each have their differences when it comes to developing websites.

My question is what are differences between ASP.NET and PHP as far as

  1. Features
  2. Security
  3. Extendability
  4. Frameworks
  5. Average Development Time

I am trying to compile a list of facts to be able to compare with the customer so that an informed choice on the appropriate development platform can be made.

share|improve this question

closed as not constructive by Jim G., Walter, Dynamic, gnat, GlenH7 Dec 22 '12 at 17:31

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

7  
I've used both, I think Visual Studio and ASP.NET are much more robust. The IDE alone wins me over. –  The Muffin Man Apr 5 '11 at 20:30
7  
PHP will always have a soft spot for me because it was my first web programming lanaguage... but after 2 years of ASP.NET C# there is simply no way I could go back.... Visual Studio IDE is wonderful! –  Dal Apr 5 '11 at 22:17
    
Yes I wish php would have some sort of main IDE, but I guess that would kill the very spirit of PHP being open source. Definetly a factor to consider. –  loyalpenguin Apr 5 '11 at 23:35
2  
6. Cost over the lifetime of the project? –  VirtuosiMedia Apr 6 '11 at 21:24
    
@VirtuosiMedia another important factor I didn't mention. –  loyalpenguin Apr 6 '11 at 22:01

5 Answers 5

up vote 31 down vote accepted

Features, Security, and Extendability are going to be more or less the same. What can be done with PHP can be done with ASP.NET.

Frameworks — Again, when it comes to features of frameworks, it will be more or less the same. However, being more specific than the language itself, you'll want to consider:

  • What your developers are most comfortable with. Knowledge = efficiency.
  • On a project-by-project basis, one framework in one language might be a better natural fit than a framework in another. Being more specific than the language itself means a framework cannot help but be well-suited to some tasks and less-well suited to others.

Average Development Time — Your average development time for a very small project might be better with PHP since web hosts are so easy to find and dev machines so easy to set up. However, with anything bigger, as long as you have good devs, or are already set up for either, it will probably be a wash.


The main consideration you should make is what technology stack your client wants to be tied to going forward. Neither mixes well (easily) with the other. They may have developers who are familiar with one or the other.

  • If your client likes the idea of being connected to Microsoft, then go with ASP.NET. Some clients will have more comfort regarding future support, upgrades, etc. with MS.

  • If they like the idea of open source and Linux servers, go with PHP. This may interest some clients due to transferability of web hosts, free software, etc.

And lastly, if they don't care, then go with what you are most comfortable with. There's not much to it beyond that.

share|improve this answer
7  
+1 for "The main consideration you should make is what technology stack your client wants to be tied to going forward." –  System Down Apr 5 '11 at 20:57
    
branching off of security is there no resource to see how each platform has performed? –  loyalpenguin Apr 6 '11 at 0:34
3  
@loyalpenguin - that is a question in and of itself. I'm not sure what you mean by "how each platform has performed", but if you are talking about platform security holes (which are almost always quickly patched) that is the least of your worries. For the most part, each language is as "secure" as the developer who's writing the code. –  NickC Apr 6 '11 at 15:23
    
good point.Just one last question How would I get out of the question which is more secure then? –  loyalpenguin Apr 6 '11 at 15:31
    
@loyalpenguin when I say it is a different question, I kind of mean the question is "Are platform security issues a major cause for concern in web apps? If so, how do I analyze which has a better history among various platforms, such as PHP, ASP.NET, Java, Ruby on Rails, etc.?" To me, I'm not so sure that it actually is a large cause for concern. –  NickC Apr 6 '11 at 15:41

Having worked extensively with both, you already know that the answers will be different depending on the problem and the client. In a very generic sense:

  • PHP is great for projects that need to work on a budget. For example, you won't get hit with big database licensing fees.
  • ASP.NET is great for projects that need the kind of support and developer culture that Microsoft provides.

If you are compiling a list of facts for your clients, base it on what you know. Your research, no matter how biased your findings, is fine for getting your bullet points.

share|improve this answer
8  
It sort of irks me when .Net gets automatically associated with "big database licensing fees." You must of course know that .Net can interface with quite a variety of RDBMS's, free and not, and of course so can PHP, free and not (and it's not like Microsoft is the only popular RDBMS with big licensing fees). –  qes Apr 5 '11 at 21:29
2  
Not to mention that the Express and Web versions of SQL Server have vastly more palatable licensing fees (free in the case of Express). –  qes Apr 5 '11 at 21:29
    
Sorry, not meant to irk. MS just seems to sell better as a full stack and I was assuming a bigger DB engine than Express. –  Fred Wilson Apr 5 '11 at 22:45
1  
Not taken personally, I just seem to see the association made quite often. –  qes Apr 5 '11 at 22:56
1  
@loyalpenguin: In my experience, it is rare to find a storage engine that isn't supported in .Net. I cannot comment on whether or not this is as true with PHP. –  qes Apr 6 '11 at 18:27

PHP vs ASP.NET is like comparing apples and oranges, there targeted for different solutions.

PHP is a better suited framework for small scale, start-up solutions. PHP will run or Linux, windows without too many requirements. Microsoft ASP.NET is an industrial strength framework, which has everything you could ever imagine and more. ASP.NET is very feature rich environment out-of-the-box. Many will argue ASP.NET is expensive, which was the case a few years ago but not anymore. First the tools are free (express editions), the database options are free (SQL Compact or SQL Server 2005 or above Express). Purchase Hosting is now very cheap, so the question isn't which is better but what suits your solution. Personally I prefer ASP.NET, but that’s because I work in a corporate environment where flexibility and scalability is very important thus the solutions dictates the framework.

One very important thing is what language are you best at? This should be the final factor in the decision.

If your goal is convincing a client, then asp.net is a better option. Big company name's backing a language makes a client feel comfortable. In this case the best options are (Microsoft) ASP.NET and (Oracle) Java JSP.

EDIT: Feature rich - ASP.NET provides two alternatives to building a website WebForms and the MVC approach. Since its apart of the .NET framework you have to very powerful features e.g. WF (workflow), DLR (dynamic Language Runtime), Parallel Linq, Linq, routing, various forms of data state management: HTTPContext items, ViewState, Runtime Cache, page output cache, three different type of session implementation InProc, State and SQL Server. ASP.NET implement various forms of security e.g. Membership Provider and Role Provider. I don't want to bag PHP, but ASP.NET is in a different league.

share|improve this answer
5  
I always heard that as an excuse, that "Microsoft = Expensive" which is why I learned PHP first. But I have to agree that really isn't the case anymore. –  loyalpenguin Apr 5 '11 at 23:33
    
Yes the playing field is quite even now, it's hard to know which language to use these days. –  Nickz Apr 5 '11 at 23:39
    
What exactly does "industrial strength framework" mean? "Everything you could ever imagine and more"? "Very feature rich environment out-of-the-box"? How is ASP.NET these things, in ways that PHP is not? Until you have explained that, this is just Microsoft advertising language. –  NickC Apr 6 '11 at 15:21
    
design goals- php originally stood for personal home pages and was designed to make simple serverside scripting easy. asp.net was built to compete w/ java ee as a enterprise level solution. php has assimilated many features over the years, but this "feature tacking" rots through in language inconsistencies and platform quirks. i use php often, but it is and was designed to be a web language, not a general purpose programming platform –  bunglestink Dec 22 '12 at 5:59

Just to give a background on what I am basing my answers on, I have done PHP development professionally for 6+ years, I have been playing around with ASP.NET MVC for about the last 3-4 months, and I have been doing C# programming for about as long as PHP programming.

For me this is more of a PHP vs C# argument than a PHP vs ASP.NET one.

Feature/Extendability
I think the ASP.NET wins out here and this is more because of the ability to use a language like C#. C# is a far better language than PHP with it come to OO support. I am also a person that prefers a statically typed language (even thought with C# 4.0, I believe that you can do dynamically typed variables). The only thing that PHP had over C# as far as a language feature was optional parameters but that is another thing that has been added in C# 4.0 (not sure how well it works as I have not tried it yet).

Security
I would probably say that it is a wash between the two. I think both of them having functionality in place to help with security but it is ultimately the job of the programmer to make sure their application is safe.

Frameworks
Well PHP seems to have a lot more mainstream frameworks (CakePHP, Codeigniter, Symfony, Zend Framework) and a lot of other smaller frameworks than ASP.NET. ASP.NET has 2 main frameworks from Microsoft, WebForms (an utter piece of crap) and ASP.NET MVC (the reason I started getting into ASP.NET development). While PHP has more frameworks, I find that ASP.NET MVC 3 framework is better than any of the PHP frameworks.

Average Development Time
I think that for smaller projects the development time is much better in PHP however as your project grows in size, C# scales better in this regard.

Cost
Some that should be brought up is cost. PHP hands down wins on this front. While you can run ASP.NET on Mono in Linux, it does come with its own problems.

If you are doing a small to mid size project and/or cost is a factor, PHP wins. If you are doing a large scale project, I would choice ASP.NET w/ C# & ASP.NET MVC.

share|improve this answer
2  
Web Forms does have benefits though. For example the thousands of ready to use controls for rapidly building web apps has been a plus to selling my customer on a website. –  loyalpenguin Apr 7 '11 at 3:57
    
I agree with @ryanzec WebForms isn't crap and is as good as ASP.NET MVC from different perspective. I've used ASP.NET MVC framework since Preview 2 of the first version in a commercial environment. Also I've used WebForms for the past 7+ years. Furthermore you can't argue costs anymore for ASP.NET, Microsoft supplies free tools, now that’s better than what PHP is offering. Also Microsoft is supplying a free version of SQL Compact and SQL Server. Third party hosting for .NET is comparable to Linux these days. –  Nickz Apr 8 '11 at 3:24
    
While I will agree that the cost of hosting ASP.NET has gotten better I can can still find cheaper VPS LAMP Hosting much easier than VPS Windows hosting. –  ryanzec Apr 8 '11 at 10:10
    
Also to the point about WebForm, saying it is crap may have been harsh, it is just not my cup of tea. It is true you can get things up faster however you once you try to do something outside what is provided to you from the components or once you what to heavily modify an existing component, it exponentially harder. Also the whole way the system works with the postbacks and stuff just seems clunky too me for web development. I prefer ASP.NET MVC as it gives me 100% controller of what is created and fit for web development a lot better in my opinion. –  ryanzec Apr 8 '11 at 10:37
    
he is absolutely right. webforms is a complete piece of shite. –  Timmerz Dec 22 '12 at 6:41

.net controls are much nicer that what you can find with a PhP platform. Look at Infragistics for instance, what is the equivalent for a LAMP ?

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.