Datasheet
16
Part I: Developing a Web Database Application Using PHP and MySQL
Advantages of PHP
The popularity of PHP is growing rapidly because of its many advantages:
✓ It’s fast. Because it is embedded in HTML code, the response time is
short.
✓ It’s inexpensive — free, in fact. PHP is proof that free lunches do exist
and that you can get more than you paid for.
✓ It’s easy to use. PHP contains many special features and functions
needed to create dynamic Web pages. The PHP language is designed to
be included easily in an HTML file.
✓ It can run on many operating systems. It runs on a variety of operating
systems — Windows, Linux, Mac OS, and most varieties of Unix.
✓ It’s available on almost all Web hosts. If you are going to publish your
Web site on a Web host, you will find PHP installed on almost all Web
hosts for free.
✓ Technical support is widely available. A large base of users provides
free support through e-mail discussion lists.
✓ It’s secure. The user does not see the PHP code.
✓ It’s designed to support databases. PHP includes functionality designed
to interact with specific databases. It relieves you of the need to know
the technical details required to communicate with a database.
✓ It’s customizable. The open source license allows programmers to
modify the PHP software, adding or modifying features as needed to fit
their own specific environments.
How PHP works
PHP is an embedded scripting language when used in Web pages. This means
that PHP code is embedded in HTML code. You use HTML tags to enclose the
PHP language that you embed in your HTML file — the same way that you
would use other HTML tags. You create and edit Web pages containing PHP
the same way that you create and edit regular HTML pages.
The PHP software works with the Web server. The Web server is the software
that delivers Web pages to the world. When you type a URL into your Web
browser, you’re sending a message to the Web server at that URL, asking it to
send you an HTML file. The Web server responds by sending the requested
file. Your browser reads the HTML file and displays the Web page. You also
request the Web server to send you a file when you click a link in a Web
page. In addition, the Web server processes a file when you click a Web page
button that submits a form.
05_527580-ch01.indd 1605_527580-ch01.indd 16 11/3/09 8:50 PM11/3/09 8:50 PM