ASP Vs. PHP

Programming for Search Engines 101. An area for avid PHP and .NET developers to chat about Programming techniques and how to make better use of search engines.

Moderator: Moderators

ASP Vs. PHP

Postby jay » Thu Aug 16, 2007 4:18 am

Both ASP and PHP are languages used to build Dynamic Web sites that can interact with Databases and exchange information. ASP (Active Server Pages) is from Microsoft and is used with IIS (Internet Information Server) that runs on Microsoft Servers. PHP (PHP: Hypertext Preprocessor) is from Rasmus Lerdorf, who originally designed this parsing language which was later modified by different people. It runs on Unix and Linux servers and it also has an NT server version.

There are a lot of differences between ASP and PHP.

Cost

To run ASP programs one needs IIS installed on a Windows platform server, which is not free. PHP programs run on Linux, which is free. Even the connectivity of the database is expensive in the case of ASP as MS-SQL is a product of Microsoft that needs to be purchased. PHP generally uses MySQL, which is freely available.

Speed


If we compare the speed of ASP and PHP then PHP has an upper hand. PHP code runs faster than ASP. ASP is built on COM based architecture, which is an overhead for the server whereas PHP code runs in its own memory space.

Platform Compatibility

PHP programs can run on various platforms like Linux, Unix, Windows and Solaris whereas ASP is mainly associated with Windows platforms. However, ASP can run on a Linux platform with ASP-Apache installed on the server.

Additional Costs


Many of the tools used in PHP are free of cost and since PHP is open source a lot of code can be found in open source forums. PHP has inbuilt features like ftp, email from a web page or even encryption mechanisms but in ASP such features are not built in and some additional components are required. Therefore an additional cost is incurred for such components.

Base Language

PHP is based on C++ language and the syntax used in PHP is quite similar to C/C++. C/C++ is still considered the best programming language by many programmers and people who love this language would surely feel more comfortable with the syntax of PHP. ASP on the other hand has a more Visual Basic kind of syntax that again is closely related to only Microsoft products. So, it depends on a person-to-person which language he or she is comfortable

Database Connectivity

PHP, being extremely flexible, can connect to various databases, the most popular being MySQL.

ASP mainly uses MS-SQL.

Conclusion

Both languages have their advantages specific to users. Some would argue that both the languages have their own importance and depending on the user's requirements the language and the platform can be chosen. If we talk about developing a discussion board then ASP is equally capable but many feel the best discussion boards are developed in PHP. If a user is looking for some e-commerce application development then many would call ASP the ideal choice. This does not mean that PHP cannot provide e-commerce solutions only that many people choose ASP.
jay
 
Posts: 475
Joined: Wed Nov 22, 2006 12:05 am
Location: Cochin, India.

Postby Robert » Tue Aug 21, 2007 11:17 am

Very nice breakdown, Jay.
Robert
 
Posts: 145
Joined: Fri Jul 27, 2007 12:43 pm

What about .net advantages?

Postby prasanth » Tue Aug 21, 2007 10:06 pm

Nice!

I wonder if .Net guys have anything to say about some ASP.Net advantages. :)
prasanth
 
Posts: 304
Joined: Fri Nov 24, 2006 1:52 am

Postby Guest » Tue Aug 21, 2007 11:15 pm

Guest
 

ASP Vs. PHP - II

Postby jay » Wed Sep 26, 2007 4:29 am

Security Considerations

Anything can be hacked, no matter how strong the security. The only thing lacking is the time and the resources of how to do it.

Apache's security options make it more secure than Windows Server Operating Systems. IIS is known for many security holes and constant patching. However, I will not be one to say that Apache is security foolproof.

Programming Heritage

ASP has its roots in Microsoft's most commonly known language, Visual Basic. For this reason, it is very simple to learn and incorporate. PHP has more of a C++ language base. I believe that this also contributes to its speed abilities.

Speed questions


Here is where the most arguing is spent for loyalists of both sides of the server-side scripting world. This has been a large debate since both languages came into existence. This is an area that I do believe is greatly significant.

When an Operating System (OS) delegates memory to applications, the application will usually give back the memory. Operating Systems do not ask for that memory back so long as the application is still in use. PHP has a unique way of using this memory usage to its advantage. PHP grabs a memory block and holds it. When it frees up, it is not returned, but held for whatever processing that might take place in the future. This can be edited in the configuration file.


Truly, the main distinguishing factor will always be the computer on which the web server is run. If the machines are not similar, the language on the faster machine will indeed be faster than the other no matter what the strengths of memory or processor usage.
jay
 
Posts: 475
Joined: Wed Nov 22, 2006 12:05 am
Location: Cochin, India.

Why PHP 5 Rocks!

Postby jay » Tue Oct 09, 2007 7:07 am

1. Robust Support for Object-Oriented Programming

With PHP 5, PHP programmers can at last stop apologizing for PHP's krufty OO support. It offers:

* Constructors
* Destructors
* Public, protected, and private properties and methods
* Interfaces
* Abstract classes
* Class type hints
* Static properties and methods
* Final properties and methods
* A whole suite of magical methods


Additionally, objects are now both assigned--and passed--by reference instead of by value, so the necessity to liberally sprinkle ampersands throughout your code is no more.

If you're a person who enjoys web programming using objects and patterns, then these features alone will make your year. However, PHP 5's just getting started.

2. A Completely Rewritten MySQL Extension

The MySQL database is PHP's partner in crime. Many developers power their web sites with MySQL, yet the MySQL extension is showing its age. In retrospect, some design decisions weren't the best solutions after all.

Also, the latest versions of MySQL, 4.1 and 5.0, introduce many new features, some of which require significant changes to the extension. As a result, PHP 5 comes with a completely new and improved MySQL extension. Dubbed MySQLi, for MySQL Improved. It offers:

* Prepared statements
* Bound input and output parameters
* SSL connections
* Multi-query functions


MySQLi even takes advantage of PHP 5's new object-oriented support to provide an OO interface to MySQL. On top of that, the latest versions of MySQL now enable subselects, transactions, and replication.

3. A Suite of Interoperable XML Tools

PHP 5 fixes the major problems in PHP 4's XML extensions. While PHP 4 allows you to manipulate XML, its XML tools are only superficially related. Each tool covers one part of the XML experience, but they weren't designed to work together, and PHP 4 support for the more advanced XML features is often patchy.

Not so in PHP 5.

The new XML extensions:

* Work together as a unified whole.
* Are standardized on a single XML library: libxml2.
* Fully comply with W3 specifications.
* Efficiently process data.
* Provide you with the right XML tool for your job.


Additionally, following the PHP tenet that creating web applications should be easy, there's a new XML extension that makes it simple to read and alter XML documents. The aptly named SimpleXML extension allows you to interact with the information in an XML document as though these pieces of information are arrays and objects, iterating through them with for-each loops, and editing them in place merely by assigning new values to variables.

If you know the document's format ahead of time, such as when you're parsing RSS files, REST results, and configuration data, SimpleXML is the way to go.

And if you're a DOM fan, you'll be pleasantly surprised with PHP 5's DOM extension, which is light-years beyond what you're using in PHP 4.
4. An Embedded Database with SQLite

While MySQL is greater than ever, it's actually "too much database" for some jobs. SQLite is an embedded database library that lets you store and query data using an SQL interface without the overhead of installing and running a separate database application.

When your application needs a server-side storage mechanism but you can't rely upon the presence of a specific database, turn to SQLite. It correctly handles locking and concurrent accesses, the two big headaches with homebrewed flat files.

PHP 5 bundles SQLite, providing developers with a database that's guaranteed to work on all PHP 5 installations. Despite the name, SQLite is nowhere close to a "lite" database. It supports:

* Transactions
* Subqueries
* Triggers
* And many other advanced database features


You can even write user-defined functions in PHP and call them from within SQLite. This is by far and away the coolest feature available in any PHP database extension.

5. Cleaner Error Handling with Exceptions

PHP 5 offers a completely different model of error checking than what's available in PHP 4. It's called exception handling. With exceptions, you're freed from the necessity of checking the return value of every function. Instead, you can separate programming logic from error handling and place them in adjoining blocks of code.

Exceptions are commonly found in object-oriented languages such as Java and C++. When used judiciously, they streamline code, but when used willy-nilly, they create spaghetti code.

Right now, only a few PHP extensions use exceptions, but they're slowly being phased in. However, they're available today for any PHP code you write.

6. A First-Class SOAP Implementation


SOAP is a key component of the fast-growing web services field. This extension lets developers create SOAP clients with or without a Web Services Description Language (WSDL) file, and also implement SOAP servers in PHP.

PHP 4's SOAP support is only fair. While there are a few SOAP packages, the most mature ones are written in PHP instead of C. Therefore, they are slow, and you have to download and install them yourself.

With PHP 5, there's finally a usable SOAP extension written in C. Currently, this extension implements most, but not all, of SOAP 1.2. This is a significant improvement over previous C extension, and future pieces will be added in time.

Hope this quick tour around PHP 5 useful. PHP 5 is leaps and bounds better than before. You can find all sorts of cool ways to incorporate its features into your programs.
jay
 
Posts: 475
Joined: Wed Nov 22, 2006 12:05 am
Location: Cochin, India.

Postby DJ » Sun Nov 11, 2007 3:59 am

So does this mean that it really is just a matter of preference then when choosing a language? Both PHP and .NET offer the exact same abilities... it just then depends on the talent of the programmer on the project?
The Deej
|
DJ
Site Admin
 
Posts: 1022
Joined: Thu May 04, 2006 4:47 pm


Return to Programming

Who is online

Users browsing this forum: No registered users and 3 guests

cron