- Web Application Planning
- PHP vs ASP.net Comparison
- Web Application Framework Comparison
- Web Application Development Process
- Guide to Web Application Development
- Internet Database Development
- PHP & MySQL Development
- What is Content Management System (CMS)
- Drupal vs Joomla vs WordPress CMS Comparison
- Enterprise CMS Comparison - Summary
- Enterprise Content Management System vs Open Source CMS - Detailed Guide, Security, Performance Statistics
- Pros and Cons of Wordpress, Joomla, Drupal
- Enterprise eCommerce Platform Comparison
- Magento vs OScommerce vs Zen Cart Comparison
- Best eCommerce Software
- eCommerce SEO
Business Planning for Web Projects
- Internet / Online Business Ideas and Strategies for Entrepreneurs
- Web Development Cost Comparison
- Hiring a Web Application Company Considerations
- How to Hire a Good Web Application Development Company
- Challanges for hiring Offshore Web Development Company
- Guide to Merchant Account Payment Gateways
- e-Business Strategy and Process
Server Management and Hosting
- Dedicated / Managed Hosting Comparison
- Shared Hosting vs Managed Hosting
- Domains, DNS, Web Hosting, Email
- Domain Name System and DNS Servers
- All About Domain Name Registration
PHP vs ASP.net Comparison
A comparison of PHP (Open Source) vs ASP.net (Commercial), Performance, Cost, Scalability, Support and Complexity
There are hundreds of forum debates and articles on the Internet about whether PHP or ASP.net is a better platform.
Unfortunately, most opinions are biased and their preference is typically based on promoting one programming language over the other.
Also, if you pay attention to the dates on those articles and debates, you will see that most of the information is outdated and old. This is unfortunate — the debates are showing on top of search engines and the information is no longer valid. We need to consider that there are periodic major upgrades and improvements done to both PHP and ASP.net platforms.
Let me assure you that both programming languages are used in very large web applications and large successful web sites so there should not be any doubt to the ability of any of the above programming languages to handle a large web application project.
In this article:
Regarding performance, I'll explain what factors will effect performance and the result will prove that selecting one programming language over the other because of speed is pointless in most scenarios.
Regarding scalability, I'll explain what factors to consider when it comes to scalability and if programmed correctly, both programming languages are very scalable.
Regarding cost and support, since PHP is open source and commonly runs on an open source platform, LAMP (Linux, Apache, MySQL, PHP), PHP wins over ASP.net for providing the most cost effective solution and providing a large amount of resources and support.
Regarding time to deployment (an additional concern for cost,) on average, it takes twice as much code writing to accomplish something with ASP.net than PHP, so time to deployment is faster using PHP.
I'll go over each of the considerations and also provide my two cents below:
I. Scalability and Ease of Maintenance
Scalability and ease of maintenance have nothing to do with whether you select PHP or ASP.net platform. Web Application scalability and ease of maintenance primarily depend on:
- Programmers' experience
- Using the best programming practices
- Using a solid programming framework
- Following programming guidelines and standards
II. Performance and Speed
There has been much debate about this subject and most of the debates have been biased and have been tailored to promote one of the programming languages instead of informing the audience.
There are so many other factors to consider when it comes to measuring web application speed, so the speed of any
programming language should not have any noticeable effect on the speed and performance of most of the websites today.
However, if the programming language needs to perform enormous tasks similar to the kind that sites such as Google or Yahoo do daily, then there should be a lot of consideration in selecting a very fast programming language for required enormous tasks — that is why Google and Yahoo use several programming languages (mostly open source), each selected to handle the tasks that the programming language is best at performing.
Below, I'm going to analyze the common and uncommon scenarios and explain which task is better than the other:
1st Common Scenario:
One of the common tasks of any web application would be to access and query the database and output the result to the web server and then to the browser. So on this common scenario, all the programming language is doing is communicating / interfacing with the database server and web server. On this common scenario, the speed of the programming language has almost no affect on this process; the speed of this process relies on the database server, web server, client's web browser / computer and bandwidth.
When it comes to the main and common database servers, MySQL (now owned by Oracle), PostgreSQL, MSSQL and Oracle are all fighting for speed and performance. We keep seeing new features and better performance by all database servers in each version upgrade so I will say that the above database servers will all have a great performance if the database programmers use optimized and practical SQL queries and if needed, use the advanced features such as caching.
MySQL is used by Google, Facebook, YouTube, Yahoo and recently on FIFA World Cup which received a huge audience around the World. So I would not question the capability of the MySQL database server.
Based on my research on a few online stats, as of this writing, the communication and interfacing between PHP and MySQL is faster than ASP.net and MSSQL but it is not very noticeable.
2nd Common Scenario:
One of the other common tasks of any web application would be to access the file system, find an image and send it to the web server. In this case, again, the programming language is doing very little — it is the Operating System and the file system that has the burden of communicating with the programming language.
Based on my research on a few online stats, as of this writing, the Linux OS and ext4 (file system) performs better (IO) than Windows OS and NTFS (file system.)
3rd Common Scenario:
Most Linux / Unix servers are run very lean without any extra un-needed packages or GUI interfaces and therefore the OS uses a lot less CPU and RAM which provides more allocation to the database and web server.
Most windows servers run clunky and with many un-needed packages and GUI which will be using much more CPU and RAM.
Obviously, a LAMP platform will have an advantage over the ASP.net platform because it will have more available resources.
4th Not Very Common Scenario:
ASP.net is usually written in C# (pronounced C Sharp) — generally speaking, as of this writing, C# is a faster programming language than PHP. (This may change as each programming language will come up with upgrades to fight for a better speed.) So if the programming language needs to run a 2,000,000 loop execution of a calculation, an ASP.net written in C# will win over PHP. However, this is a very uncommon scenario, the most loop executions of a calculation would be in 100s and not 2,000,000s. And in this case, there should be other concerns about why someone needs to do a 2,000,000 loop calculation.
Additional items that can have an effect on performance but have nothing to do with which programming language is selected are:
- Ability and knowledge of programmer(s) to optimize the code
- Ability and knowledge of programmer(s) to write proper and optimized SQL queries.
- Functionality required (some functions may take longer to execute in the ASP.net platform and less time in PHP platform and vice versa.
PHP, MySQL server, PostgreSQL server, Apache server, and Linux OS are all free and upgrades are also free. In addition, there is no additional licensing cost for having another hot standby server as a backup, or needing to run multiple servers for load balancing or server clustering.
LAMP (Linux, Apache, MySQL and PHP) is also much more popular among hosting companies, and its popularity results in a lower monthly hosting cost for LAMP hosting compared to Windows hosting.
ASP.net and IIS are free if you purchase Windows OS. There is a substantial licensing cost for a Microsoft Windows Server, Microsoft SQL Server and future upgrades. For example, Microsoft Server 2008 R2 Standard - 64-bit cost is about $1029 and Microsoft SQL Server 2008 Standard Edition For Small Business cost approximately $1038.
The above licensing costs for Microsoft can substantially increase if the site becomes popular and there is a need to run the site on multiple servers or requires server features such as load balancing, server clustering or hot standby.
IV. Support and Resources
Since LAMP is open source, there is a vast amount of dedicated and friendly developers around the world who continuously make improvements and updates, and provide support for the platform. Additionally, there are more support resources and developers available for PHP and LAMP Platforms.
The reason why I mentioned the word "friendly," is because Open Source developers who contribute to the Open Source community are doing so not for financial gain. If you seek help with a functionality challenge and post a question on a PHP forum, you will receive useful information from friendly contributors.
ASP.net relies on an available number of developers at Microsoft for making improvements and updates. There are less support contributors available to solve ASP.net challenges.
V. Time to Deploy
It takes a larger amount (more lines) of code to accomplish complex features and functionality with ASP.net compared to PHP, adding more time to the development process.
Additionally, PHP is interpreted at the server, so when changing a functionality, no additional steps are required to see the changes. On the other hand, ASP.net needs to be compiled each time the code is modified. Again, the development process is more time-consuming when using ASP.net as opposed to PHP.
VI. Editors and Tools
PHP & MySQL is editor independent. PHP developers have access to an extensive number of editors.
Most ASP.net programmers rely on Microsoft Visual Studio editor to help them develop .NET Applications. (Many ASP.net developers love and swear by the Microsoft Visual Studio.)
It is a different style of programming — PHP and open source developers tend to use text editors such as VI, VIM, Notepad ++.
VI. Platform Independent
PHP is platform independent and can run on any platform — Linux, Unix, Mac OS X, Windows.
ASP.net is built to run only on Windows platform.
VI. Which popular sites run on which platforms?
The following table lists the top, popular sites and the platform and languages they use.
Note: Please don't confuse C with C# (pronounced C Sharp) — they are completely different programming languages. ASP.net is mostly programmed in C# (C Sharp) or Visual Basic and not C.
|Site||Up Since||Server Platform||Programming
|Google.com||November 1998||Linux||C, Java, C++, PHP & MySQL|
|Facebook.com||February 2004||Linux||PHP, MySQL and C++|
|YouTube.com||February 2005||Linux||C, Java and MySQL|
|Linux||C++, C, Java, PHP & MySQL|
|MSN.com (owned by Microsoft)||August
|Live.com (owned by Microsoft)||August
|Linux||PHP & MySQL|
|Linux & Solaris||C++, Java, J2EE|
|Linux||PHP & MySQL|
The LAMP platform is much more popular than the Windows platform. Based on Netcraft's July 2010 Web Server Survey of 205,714,253 sites, 112,945,968 (54.90%) are hosted on Apache and 53,217,620 (25.87%) are hosted on Windows; the rest are hosted on other platforms.
VII. Usability and Ease of Deployment
There are many misconceptions and misinformation about Linux being unfriendly.
This really depends on the experience and knowledge of the person setting up the platform.
However, I have to say that I'm very impressed with the new and improved versions of popular Linux distributions. These distributions of Linux such as Ubuntu, Red Hat, CentOS, openSUSE, and Fedora have done a great job providing ease of installation and deployment, as well as a simple and straight forward GUI interface that makes configuration and setting up of a Linux server very manageable.
Unfortunately, in my opinion, Microsoft Server has been going backward with usability, by making the server administration extremely clunky and filled with complex and un-needed features.
Research for this article was completed August 1, 2010; pricing and other information may change.
Bernard Kohan is a web application development and technology analyst expert. He is available to discuss any issues or questions you have about web development and the best choices for your company or project.
Bernard can be reached at
Web Application Estimator
Select and unselect modules such CMS or eCommerce for your potential web application and watch the cost update in real time.Try It »