Thu, Aug 17, 2000; by John Lim.
Microsoft's Active Server Pages is a wonderful technology for creating dynamic Web pages. I've been using ASP for over a year, created many Web sites using it, but now my company is thinking of switching to another popular Internet technology called PHP for future Web site development.
The strange thing is that we are comfortable with ASP and like using it. So why switch?
Open Source Movement
The first reason is that we realise that the Open Source movement is real and gaining momentum. We wanted to leverage on the large body of useful and free code available in the Open Source world.
For example, to perform binary file uploads, retrieve a file via FTP or HTTP, encrypt passwords in MD5, or send email from a Web page require 3rd party commercial software packages in ASP. Its all available for free in PHP.
But that wouldn't have been enough to convince us to switch because we had already invested the time and money to purchase the necessary commercial software utilities.
Internet Appliances and Linux
I have seen the future and it is RaQ. When I saw my first Cobalt RaQ, I had a dream that every application an office would need would be available as an Internet appliance. Instead of buying a software package and worry about installing it, they would buy an Internet server appliance with the software preinstalled, and just run the application off their Web browsers with little configuration needed.
Most Internet Appliances run Linux and PHP. They don't normally run ASP. There is a product called Chilisoft ASP that allows you to run ASP scripts on Linux, but it's expensive, and doesn't support the latest version of ASP. Furthermore, all the nice 3rd party Windows DLL's needed to create quality ASP Web sites aren't available on Linux.
So we decided to look for a good programming technology similar to ASP and compatible with our dreams of Internet appliances.
PHP comes the closest to ASP in its philosophy of coding. In fact, PHP has an ASP tag emulation mode that we find very useful. The team at Zend.com that is developing the core PHP engine has just developed an ISAPI engine for PHP.
ISAPI is the API to Microsoft's Internet Web Servers, and by supporting it PHP becomes accessible to the many Windows programmers out there (including myself) who want to dip into the Linux market.
The Technical Stuff
Lies, lies, lies, and damn benchmarks. Everyone claims their product is the fastest. I don't really care about that -- I'm only interested in fast enough. By that criteria, PHP is fast enough.
ASP supports multiple programming languages. This architecture is inherently slower and more memory intensive that PHP's model because each ASP language compiler runs in its own process. So when ASP detects a Begin ASP tag (<%), it needs to do a context switch out of the HTML parser, and select the appropriate compiler. Then at the End ASP tag (%>) it will do a context switch back to the HTML parser.
So assuming that the PHP developers at Zend and the ASP developers at Microsoft are equally good, ASP will always be inherently slower because of ASP's more multi-lingual architecture.
Zend also intends to release by the end of this year(2000) a PHP compiler to protect our source code, and various optimization technologies (Zend Cache and Optimizer) and appears committed to make PHP run well on Windows.
A Business Decision to Use PHP?
Not completely. There were many Open Source alternatives to PHP, including Perl, Python/Zope and JSP/Tomcat. It just seems to me that PHP is so similar to ASP that it's an easy switch.
Perl: An ugly language unsuitable for large projects.
Python/Zope: Good design, but Zope's philosophy is closer to Cold Fusion that ASP.
JSP/Tomcat: Web pages are better manipulated with scripting languages rather than type-safe, type-bound, type-checking Java in my opinion.
We also noticed that our code is now substantially shorter with PHP than with ASP. This is because the HTTP GET and POST variables are automatically created by PHP as global variables so we don't have to waste time extracting them from the ASP Request object.
The PHP include() statement is nice because we can conditionally include scripts, making our code smaller.
PHP has session and cookie management functions similar to ASP. The HTTP header manipulation functions in ASP are easier to use though.
The only thing lacking in PHP is the ASP equivalent of Application variables which are available for the life-time of the Web server.
I'm still trying to get used to the PHP syntax with $ signs everywhere, but its cool because that's my favorite symbol.
7 Reasons Why PHP is Better than ASP A newer and more technical article.
A more technical view of ASP and PHP3 by Mark Edwards.
Another ASP vs PHP3 article by the Mark Edwards.
Switching to PHP: What's the Language Difference?
PHP compared to Cold Fusion
PHP compared to Perl
Aaron Sherman disagrees: Perl is not ugly.
Users browsing this forum: No registered users and 3 guests