When building a website you'll eventually run across a time when HTML and javascript can only go so far. This leaves a couple of possibilities, JSP, ASP and PHP. While JSP can do a lot for you, it's not necessarily the language of choice. This then leaves ASP or PHP. ASP stands for Active Server Pages and was developed by Microsoft based on vb-script and only runs on Microsoft Servers. PHP or PHP: Hypertext Preprocessor, created by Rasmus Lerdorf, is an open source language that has an ever growing community. PHP is able to run on UNIX, Linux and even NT servers. So how do they match up?
To run a PHP server, all one needs to do the following:
So the only output expense here is the purchase of a robust enough server to handle your website needs.
ASP on the other hand can be expensive. Here's the breakdown:
NOTE: For ASP.NET all you need is to download the .net framework, download MSDE (MS SQL Light) and the ASP.NET web matrix, all of which is free. However, the SQL-light edition may not be allowed for corporate use.
Running ASP does indeed have a higher start up cost, however this is all relative to which operating system and programming language you're comfortable with. Contrary to some other posts out there, IIS is actually free. It comes with every Professional and Server version of Windows, and only needs to be installed by running Add/Remove programs. So really the only expense is to purchase a server running Windows and potentially MS SQL. The fact that bringing up a PHP server is extremely inexpensive, PHP wins this one hands down.
The speed between ASP and PHP to the end-user is generally non existent. However, ASP runs using a COM based Architecture, which increases the load on the server, thus slowing down the overall efficiency of the code and the system itself. PHP on the other hand runs on it's own memory space. This not only speeds up the time your PHP programs run, but it's also extremely efficient. In this case, PHP again wins. However, read the Compiling section below to compare PHP against ASP.NET.
PHP is based on the well known C++ language. The syntax and overall feel of the language is very similar to C/C++. Since C++ is one of the premier languages for developing software applications, it would be natural for a programmer to be comfortable when working with PHP.
ASP has 8 objects and uses simplified form of the popular Visual Basic language, known as vb-script. ASP can be easier for new programmers to learn since it's based more on the English Language rather on a complex programming language. Since vb-script is included with every version of Windows since 98, and Windows is the most common operating system, so in this case it's a matter of preference for the programmer. PHP's C++ style or ASP's vb-script.
As stated before the most popular forms of Web Design databases are MS SQL and MySQL. However there are several other database applications that can also be utilized. Below is a known list of databases run on various web servers.
PHP and ASP can both connect to each of these systems since the underlying language is based on the popular Structured Query Language or SQL. The most common for these two to utilize is MS SQL and MySQL. However if you want the same type of functionality, such as stored procedures and the like, then you should run PHP with Postgre SQL instead. But again it all depends on your experience and comfort level with databases. In general I recommend MySQL or Postgre SQL since they're both free and very robust.
Even though PHP is extremely robust itself with a myriad of functions, its components are widely open source and can easily be found by running a simple Google search. ASP on the other hand can work with several of Microsoft's own products including Office itself. This makes it quite handy when you want to display a chart, graph, slide show and the like. To do the same in PHP requires a more high level programming knowledge or a very well rounded component.
While PHP programming is well, only PHP and maybe some java script, the introduction of ASP.net allows the programmer to choose between C#, C++, VB, Python, etc... This means your not just stuck with ASP's vb-script with some java script mixed in. However, PHP 5 has made leaps and bounds in the language making it just as robust and well rounded as ASP.net. In fact comparing PHP to .NET is rather difficult since .NET is an environment for building and executing applications, not a programming language. So basically your comparing PHP to [insert a Microsoft language here].net. However, you can use Java for PHP, or the new upcoming Python extension.
The biggest statement coming out with the .NET crowd is "PHP isn't compiled, except at runtime and .NET enjoys all the benefits of being compiled" isn't entirely accurate. Microsoft's use of the term "compiled" is not what a normal C++ coder would call "compiled". Zend has been doing this for a while now with PHP Accelerator. However, ASP.NET does indeed compile better and faster out of the box than PHP. The only way to achieve the same results with PHP is to use Zend's PHP Accelerator as mentioned above. The draw back is that in most cases, it's not installed by default on the server you're running.
So when the time comes that you need support for your product, where do you turn. With ASP you have Microsoft to lean on, a household name. However, in PHP you have an entire community from NuSphere, any of the numerous partners on Zend, or the entire PHP community including WWW.PHP.NET.
While .NET claims it is a superior object oriented programming environment, starting with version 4.3, PHP can probably claim this title. PHP allows you to use OO programming when ever you need it. The .NET frame of mind tries to force you into that paradigm from the beginning. However, in general the web doesn't require OO programs for the average website. Most sites, are more "hacked" together than anything else, so I wouldn't sweat too much over this subject. If you need it, you can bet that both can do it but PHP can probably do it better.
While ASP doesn't have a whole lot of useful templates, ASP.NET offers a whole slue of templates to choose from. How developers feel about these templates, still remains to be seen. PHP on the other hand has more templates than people have excuses (so to speak). You can easily make your own template in PHP or choose from the many professional, fully customizable templates. Oh did I mention that they're open source too?
This is simply not true. In fact in June of 2002, PHP over took ASP to become the first open source project to come from behind and surpass Microsoft's solution.
With that said, which is the better web development language? Considering ASP's slow decline, ASP.NET's steep learning curve, and the shear cost to either self host or utilize a hosting company for a ASP site, PHP is the superior web programming language. PHP hosts are inexpensive (see SiteGround's Web Hosting) and full of support, templates and customizations to ease you into the dynamic world of PHP.
See Also:
.NET vs PHP: Top 10 .NET Myths Exposed
.NET vs PHP: Top 6 Reasons to Use .NET
| Post By: Robin Jones Date: 2008-08-27 22:50:32 |
| Interesting Information. I'm personally an ASP fan, but your take on PHP is interesting. |
| Post By: Logan Date: 2008-08-27 20:58:16 |
| I agree with you Mike. Great post, very clear and concise. |
| Post By: Mike Date: 2008-08-27 20:43:23 |
| Great Post! I've been looking for information regarding a comprehensive comparison between ASP and PHP for a while now. |