03-07-2012, 11:54 AM
Murach’s PHP and MySQL
PHP and MySQL.pdf (Size: 1.44 MB / Downloads: 173)
Introduction to web development with PHP
This chapter introduces you to the concepts and terms that you need for
developing web applications with PHP. This chapter also shows you how to
deploy, edit, and test a PHP application. When you finish this chapter, you’ll
have all the background you need for learning how to write the code for PHP
applications.
How a client-server architecture works
Web applications use a client-server architecture. This architecture consists
of servers that share resources with clients over a network. Figure 1-1 shows the
components of a simple client-server architecture.
A server can share resources such as files, printers, web sites, databases,
and e-mail. A web server is a server that shares web sites, and a web browser is
the client software used to access the web server.
A network is a communication system that allows clients and servers to
communicate. A Network Interface Card (NIC) connects the computer to the
network. This connection can either be wired or wireless. Ethernet is a common
type of wired network. Wi-Fi is a common type of wireless network.
The network is responsible for getting information from one computer to
another. This process is called routing. A router is a device that is connected to
two or more networks. When information comes in from one network, the
router determines which network is closest to the destination and sends the
information out on that network.
How static web pages are processed
A static web page is a web page that only changes when the web developer
changes it. It is a plain text file that contains all the content to be displayed in
the web browser. This web page is sent directly from the web server to the web
browser when the browser requests it.
Figure 1-2 shows how a web server processes a request for a static web
page. The process begins when a user requests a web page in a web browser.
The user can either type in the address of the page into the browser’s address
bar or click a link in the current page that specifies the next page to load.
In either case, the web browser builds a request for the web page and sends
it to the web server. This request, known as an HTTP request, is formatted using
the HyperText Transfer Protocol (HTTP), which lets the web server know which
file is being requested. In this figure, you can see the content of a simple HTTP
request.
How dynamic web pages are processed
A dynamic web page is a page that’s created by a program or script that’s
running on a server. This means that the page can be changed each time it is
viewed.
The changes in the page can come from processing the form data that the
user submits or by displaying data that’s retrieved from a database server. A
database server stores information that’s organized in tables, and this information
can be quickly retrieved by a database query.
Dynamic web pages enable web developers to create interactive web
applications. As a result, users can purchase goods and services, search the web
for information, and communicate with other users through forums, blogs, and
social networking sites. Sites like these would be difficult or impossible to
create without database-driven, dynamic web pages.
A survey of web application software
Figure 1-4 summarizes the software for the four components of a web
application: web browsers, web servers, server-side languages, and database
servers. The first web browser was developed in 1991 by Tim Berners-Lee at
the European Council for Nuclear Research (CERN) in Geneva, Switzerland.
Since then, dozens of web browsers have been developed.
Microsoft’s Internet Explorer (IE) is the most widely used web browser. It
is currently available only for Windows, but an earlier version for Mac OS was
available until January 2006.
Firefox is the second most widely used web browser. It is available for
Windows, Mac OS, Linux, and other operating systems. Firefox was built using
source code from the original Netscape Navigator web browser.
Highlights in the history of MySQL
Figure 1-5 also summarizes some of the highlights in the history of
MySQL. To start, MySQL 3.23 was released in 1995. This version of MySQL
became widely used by many web sites. Then, in 2003, MySQL 4.0 introduced
support for unions. In 2004, MySQL 4.1 introduced support for subqueries and
prepared statements. In 2005, MySQL 5.0 introduced support for stored procedures,
triggers, views, and transactions. Finally, in 2008, MySQL 5.1 introduced
support for row-based replication and server log tables.