PHP vs ASP.Net

aspvsphp By the moment that ASP.Net came to the surface, there has been a long debate among programmers which one is better or not. Since I have used both languages, I will try to do a quick comparison. But lets start with some history first.

PHP traces it roots back to a 1995 Perl application designed to track accesses to Rasmus Lerdorf’s online resume! Two years later, his subsequent open-sourced C implementation of his Personal Home Page / Forms Interpreter – PHP/FI – was installed on 1% (~50,000) of the world’s Internet domains. In 1997 Andi Gutmans and Zeev Suraski do a third rewrite of the C implementation intended for their ecommerce application which was designated as PHP 3.0, a recursive acronym for Hypertext Pre-processor. PHP has now reached version 5.3.x and 6.0 is on the way!

ASP or Active Server Pages is the first attempt of Microsoft to create a server-side language used for generating dynamic and interactive pages. In 2002 Microsoft releases the ASP.NET as a successor to ASP. ASP.NET is built on the Common Language Runtime, which allows programmers to write ASP.NET code using any supported .NET language (C#, C++, J#, Jscript.NET, Python, Ruby, etc). At the moment ASP.NET is at version 3.x.

Here are some interesting comparative details for both languages:

  • PHP generally is much simpler than ASP in terms of usage. PHP was written in C which make coding simple. On the other hand ASP uses a simplified form of Visual Basic language known as VB script (although with .NET you can choose between all the different languages mentioned above). However ASP has a steeper learning curve.
  • One of the big advantages of PHP is the great support of different database systems (with MySQL usually as the first choice). Although connectivity in ASP is much improved since its first versions.
  • ASP.NET is generally faster than PHP (both on Window and on Linux servers) with the exception of File Copy and Attribute operations.
  • On the other hand loading speed is a big factor. And in that case PHP is faster, because ASP uses an overhead on the server since it uses a COM based architecture (check below the advantage of compiling of ASP).
  • Related to the previous point, another important statement is that PHP isn’t compiled, except at runtime. However .NET enjoys all the benefits of fast and accurate compilation. However with PHP you can use Zend’s PHP Accelerator which is doing more or less the same.
  • When it comes to databases, MySQL on PHP is a little bit faster than SQL Server on ASP. However in terms of performance for large scale databases opinions vary.
  • .NET programming has more advanced options like multi-threading, asynchronous requests etc. So when it comes to high end performance programming ASP would probably be a better choice.
  • PHP is open source which means free to use with tons of users with helpful hints and solutions.
  • PHP enjoys the flexibility of running on various platforms such as Linux, Unix, Windows and Solaris. On the other hand ASP is primarily related with Windows platform.

To conclude, in my opinion one of the big advantages of PHP is not PHP itself, but all the programmers that have created amazing applications and tools for PHP (e.g. Drupal, Joomla, WordPress, etc.). For me that is the main factor which makes PHP my first choice.

However both languages are scripting languages of choice and are equally being used to develop rich websites with database connectivity. It is not very easy to say which one is the winner. But taking into account the current usage statue, PHP is mostly preferred.


  1. May be you are right. But, If someone has to develop desktop and web version of a applicaiton, then I think it will be better with as only ui part should differ other coding can be done with c# only 🙂

  2. My humble opinion on the subject: Any idiot can learn how to program in PHP. However, only about 5% of these people actually are good PHP programmers. PHP makes you a better programmer, you implant your own structure if you want your code to be clean and modular, and you have to be disciplined, following that structure and never going away from it. PHP also has better support, is free, and much easier to use.

    ASP.NET makes easy things absolutely painful to implant. They wanted to make a great programming language out of it, they spent so much time trying to actually make things easier to programmers that they removed all the challenge a programmer can have while programming. ASP.NET just eats your soul. I feel no pleasure programming in MVC/OO C# ASP.NET, because you’re just doing the same things over and over again.

    PHP gives you more latitude in every single aspect possible. This is why I prefer programming in PHP. Lets you imagine the solutions you want to develop, and lets you do it the way you want.

  3. link popularity is very important in order for your website to get higher up in the search results page of any search engine.”;

  4. PHP might be easy but its not for enterprise level of development tool.
    there is no benefit to start the website again in other language if its fails to deliver the high level of performance and security as well.

    Microsoft wins for this moment coz they have great exp. with the issue like hacking etc. this is why even php has support on various platform but became and argument to be compare with is just a tiny part of .net framework. so there is nothing like making comparison and all. however if u guys not agree on me then u must read the below points at least once…

    1. The code-behind allows you easier to maintain the code when it comes to large websites.
    2. You have the freedom of choosing from multiple languages (C#, VB.NET, C++, etc.)
    3. SQL Server is also very fast, secure, and it can store extremely large amounts of data; actually, there’s no limit;
    4. With ASP.NET you get the whole .NET Class Library and the thousands of third party components as well. There are definitely much more third party components out there for .NET than for PHP.
    5. The Visual Studio .NET IDE. makes coding much, much easier. It can highlight syntax, let you know when the wrong stuff is commented, do command completion, and just plain help you organize better. Visual Studio has a really nice debugger.
    6. The Compiled Code (vs. PHP Interpreted Code) – .NET compiles code, such as C#, into what its creators have termed MSIL (Microsoft Intermediate Language).
    7. In ASP.NET it’s easy to use threads and build asynchronous handlers in your server-side web code.
    8. ASP.NET developers are paid better

  5. @Article Author..
    The title of this article is PHP vs ASP.NET but you’re comparing PHP to CLASSIC ASP! No one uses classic ASP anymore. ASP.NET Does NOT USE COM based architecture, its definately NOT a scripting language,

    and database connectivity? This issue is now pretty much transparent.. ASP.NET developers don’t really care which database they connect to it all looks the same in code. But they can connect to any database including MySql, Sql Server, Oracle, Sybase, Postgre, Progress, IBM, Informix, Access, XML, Excel, Text Files, etc

    PHP makes you a better programmer? PHP encourages the use of mixing source code and logic with presentation (html).. the PHP includes have no scope and variables can get mixed and matched at will. This is very bad in programming. Also “you impant your own structure” is also a programming no-no. The reason why its hard to do “simple” things is you can no longer use “<a href=".$myVarUrl."('something here')."” .. in .net land that looks something like myVarUrl.Hyperlink = “something here”. Its actually more difficult for the average PHP programmer because it forces you to use object orientation.. Which, once you get used to it you open up a whole new world.

    They removed all the challenge a programmer? its true that with visual studio you can create a complete website complete with ajax, paging, navigation, products, categories, etc in minutes without writing a single line of code. In php that same thing would take weeks. But the challenge comes later when you need to act on events such as “datagrid bound column event” if you wanted to do something with the item before its written to the page. But believe me, in the real world of businesses they all want very custom things using XML, Web Services, Data Warehousing, Statistics, and reporting.


Please enter your comment!
Please enter your name here