Introduction
Under the hood of any e-commerce site is code implementing the logic of the business and some sort of data store for tracking products, orders and customers. Developers are faced with many options for this code. Microsoft , Sun Microsystems and other vendors provide tried-and-true platforms, with Java, Basic and C/C++ development packages and proprietary software architectures. Oracle, Informix and MS SQL are among the more popular database engines. All are flexible, powerful and reliable solutions backed by industry leaders. But such attributes often come at a steep cost.
As the open-source movement gained momentum in the last decade, pushed and pulled by the momentum of the Internet, an impressive number of mature, commercial-grade software products were produced by loose communities of developers scattered around the world. Today, a server suitable to host a typical e-commerce Web site, including an operating system, Web server software, SQL database server software and a development system can be built for what was once the cost of the hardware alone.
The Linux, Apache and PERL projects have long been prime examples of reliable, open-source software, and are mainstays of Web application development and deployment. Rising stars in this field are the PHP script language and mySQL database engine. In this article we'll explore using the PHP and mySQL in an e-commerce setting.
PHP
PHP is an HTML embedded server-side scripting language, such as Microsoft's Active Server Pages (ASP) or Allaire's Cold Fusion. "HTML embedded" means that the code is inserted directly into the HTML document (between special tags) and is interpreted by the server on the fly each time the page is requested. PHP's syntax borrows heavily from C and PERL, making the transition to PHP comfortable for those that have developed CGI applications in those languages.
Aside from the variable manipulation, flow control and function constructs expected in a general purpose programming language, PHP is tuned for Web development with automatic conversion of form variables to PHP variables and built-in functions to handle cookies and session management. Many third-party modules have been written to seamlessly integrate with PHP to extend its functionality. Modules are available that allow the developer to access other Internet services (such as e-mail), the local OS and several database packages..
PHP is distributed under its own license and is less restrictive than GNU General Public License (GPL). Commercial entities may use, modify and contribute to the code free of charge. Under certain circumstances, such as redistribution, credit to the PHP development team must be given.
mySQL
To quote the documentation, "mySQL is a very fast, multithreaded, multiuser SQL database server." Interest in mySQL has increased over the past few years along with Linux, Apache and other headliners of the open-source movement. mySQL has gained a reputation as a very reliable, affordable alternative to it's much-hyped commercial counterparts.
Features that have helped mySQL gain its stellar reputation are:
- Speed. MySQL is highly optimized for speed, and you don't have to take our word for it: Benchmarks pitting mySQL against other database servers are available at this link. Full source code for the benchmarks is provided in the source distribution, allowing first hand comparisons on your target platform.
- Stability. The mySQL core table handling and SQL parsing modules have been stable for approximately five years. Even beta releases must pass a rigorous test suite before being made available to the public. Bugs, if any, are generally found in new features and those reported are quickly tended to.
- Reliability. The mySQL team claims that reports of customer data loss are extremely rare--and never due to implementation bugs. INSERT/UPDATE statements execute efficiently, and the results are flushed to disk immediately after such operations. The link here leads to the "Transactions" section of the mySQL manual, which contains a discussion of mySQL's design decisions concerning data integrity preservation.
- Security. ACLs (access control lists) stored in mySQL's master database provide very safe, granular control over access to data. Of course, careful attention must be paid not only to the database server security, but system-wide security to ensure that the database cannot be compromised.
- Manageability. Several interactive and command-line utilities are supplied with the mySQL server "out of the box" that allow quick access to database/table creation, user administration, server status and table optimization.
For detailed feature comparisons of mySQL against commercial and noncommercial database servers, check out the "crash-me" application. This application is a suite of over 450 tests that are actually run against live, default installations of the selected database servers.
From a portability standpoint, mySQL is almost entirely ANSI SQL92-compliant. The server may be run in ANSI mode, guaranteeing queries will be parsed according to the standard. In addition, mySQL offers extensions to the standard syntax and data types. Handy syntax extensions, such as REPLACE and SHOW statements, are available. REPLACE behaves like an INSERT statement. However, if the key value of the new record matches the key value of an existing record on a unique index, the existing record is deleted before the new one is insertedısaving an explicit DELETE statement. The SHOW statement retrieves information about databases, tables, columns and status information about the server itself. AUTO_INCREMENT may be specified as an integer column type attribute that will cause the server to assign the field the next sequence number on each insert automatically. Weıll be using the AUTO_INCREMENT column type attribute in our example to assign a unique ID to our products and orders. See section
5 of the official mySQL documentation for a brief summary of the differences between mySQL's implementation and the ANSI standard.
One of mySQL's main design goals is speed. Features not included in mySQL typically are not there for a good reason: They compromise performance. MySQL is under constant development and new features are always being added based on customer demand and efficient solutions. Missing features include subselects, selecting directly into a table, stored procedures, triggers, foreign keys and views. A list of missing features can also be found in Section 5 of the mySQL official documentation.
Originally, mySQL source and binary distributions were available free of charge to develop with, but a nominal fee was required if the server was used for commercial purposes. In June 2000, with new financial backing, mySQL went fully GPL and is available at no charge to deploy in most settings. A paid license is typically required if the mySQL server (or a modified version of it) is distributed with an application. Using mySQL as the back-end database on a unique purpose Web server does not require a license fee.
The No. 1 reason that open-source solutions fail to make it off the drawing board in larger corporations is lack of support. Corporations have formed around many of the most popular open-source projects that offer support for a fee, and many have excellent documentation and active online communities from which to get answers. Customers that rely on mySQL to run their businesses are encouraged to purchase e-mail support or login support. With e-mail support, answers to your questions and requests may be obtained directly from the mySQL development team via e-mail. Login support includes e-mail support, a mySQL representative may login to the problem system and attempt to solve specificissues, and moderate phone support from a mySQL developer. "Extended" login and phone support options are also available.
Page 1 | 2 | 3 | 4 | 5 | Next page
Send your comments on this article to Patrick A. Paskvan at paskvan@data.assist.com.