Domainmonster.com Domain Editorials
Dynamic Web Pages: ASP vs. PHP
Using server-side scripting for dynamic web content is extremely important and useful. But choosing between the many available platforms for creating this content can be a daunting task. This article will focus on the definition of dynamic web content and the purpose of server-side scripting, and then consider the benefits and disadvantages of using PHP or ASP for dynamic web content.
Why Dynamic Content?
As ecommerce and other interactive website features become increasingly important, the proportion of websites which don't feature dynamic content of some sort is rapidly dwindling. Dynamic content is the term used to describe features of web pages and websites with which the user can interact. This is in contrast with static pages, which the user simply views and navigates between.
Client- and Server-Side Scripting
There are two ways to create dynamic content: client-side scripting and server-side scripting. Client-side scripting causes the web user's browser to act on particular instructions such as keyboard or mouse commands. Flash games are an example of client-side scripting. The dynamic features created with client-side scripting occur within the context of a single impression of a web page.
Server-side scripting, meanwhile, causes changes when web users navigate from one page to another. For example, server-side scripting might be used to facilitate the submitting of information to a database via an online form, or the processing of an ecommerce transaction.
Server-side scripting is useful because it doesn't rely on the web user having any special browser plug-ins or other software in order to work. To play Flash games, the user must have Flash installed in their browser. But to submit an order to a shopping website, or use a discussion board, the user need only have a reasonably up-to-date web browser, and no additional plug-ins. Server-side scripting is essentially used to retrieve data from a database when the web user moves from one page to the next in a website.
Server-side scripts for dynamic content can be quite complex, and there are two leading platforms for creating them. These are ASP (Active Server Pages) and PHP (PHP Hypertext Pre-processor, formerly known as Personal Home Pages).
ASP (and ASP.NET) is Microsoft's server-side script engine, and is used prolifically in the business world. This is partly because ASP is closely integrated with Windows software such as Excel and Access. This means that companies who are newly starting up a dynamic website are easily able to integrate their spreadsheets and word processor documents into their database.
ASP scripting is usually done using the Visual Basic programming language, although add-ons are available to implement other languages such as JScript and PerlScript. It is not a particularly easy format to use, and there are only limited developers' resources available online.
ASP is particularly useful for providing ecommerce services. There are lots of scripts available online for ASP shopping carts. It is most large business' primary choice of server-side scripting engine. Because of its popularity, it will probably continue to remain the standard for large businesses, who may wish to be able to merge with other companies easily, and who do not wish to retrain their staff to cope with operating systems which are not Windows. There are many hosting options available for those who wish to use ASP.
One of the main disadvantages of ASP is its price. Paid licences are needed not only for ASP itself, but also for MS-SQL, the database software with which ASP interacts. Also, ASP only runs on Windows servers.
PHP, by contrast, is completely free, because it is based on Linux and is open source. PHP is considered by most to be far easier to learn than ASP, and because of its open source status, there is a huge amount of online support and community which has developed around it. PHP can also be run on a wide variety of different platforms, including Windows, Linux, Unix and Solaris.
PHP uses its own scripting language which is based on C/C++. It can connect to various different database types, including those using the free database software, MySQL. Discussion boards created in PHP are generally considered to be superior to those constructed using ASP. Some PHP aficionados would also argue that PHP is faster than ASP.
One of PHP's main benefits is that it is extremely feature-rich, and doesn't experience many of the complications involved with ASP. Because PHP is open source, features such as FTP, file uploads, XML and email are included, whereas these have to be paid for as add-ons for ASP users.
Lots more information about using ASP and PHP is available on the web. Safe to say, the two options have their benefits and their disadvantages. ASP is generally considered the best option for ecommerce websites, while PHP is the most popular for discussion boards. But this is only the tip of the iceberg. PHP's plethora of useful features, and the fact that it is open source, make it an attractive proposition for many developers. But the ubiquity of ASP, and more recently, ASP.NET, mean that persuading large companies to switch to PHP is a daunting task.
By Brian Jackson