A great introduction to the technologies at the basis of the Web. You will both enjoy this book and learn from it.
--Pascal Borghino, Database Architect for Yahoo! Inc
From the Author
So I rewrote all the processor-intensive code in C and was able to substantially slow down our server acquisition rate. But while C is powerful, it takes a lot of coding to replicate even basic Perl functions. So when PHP came along I was very pleasantly surprised to discover that even though it is interpreted (that is, re-compiled each time it is run), it placed far less of a strain on the servers than Perl, and also took up far less development time.
So when O'Reilly asked me to write this book I jumped at the opportunity. In it I have tried to take you from first steps, without assuming any prior knowledge other than basic HTML and maybe some CSS, through each of the technologies in turn, and along the way point out the shortcuts and pitfalls I have discovered, to give you the headstart I didn't have.
I maintain an active discussion forum on the book's topics, which is linked to via the companion website at lpmj.net, and am always happy to answer any questions you may have.
From the Back Cover
* Understand the essentials of PHP and the basics of object-oriented programming
* Master MySQL, from database structure to complex queries
* Create interactive web pages with PHP and MySQL by integrating forms and other HTML features
* Use libraries and packages such as the Smarty web template system, The PEAR program repository and the Yahoo! User Interface Library (YUI)
* Learn how to make Ajax calls and turn your website into a highly dynamic environment
* Find out how to upload and manipulate files and images, validate user input and secure your applications against being hacked
* Develop best practices for error handling, user authentication and website usability
Programming tips and exercises in each chapter will help you practice what you've learned. If you have a graphics or web design background and know your way around HTML, this book will have you building interactive websites quickly.
About the Author
Robin Nixon has worked with and written about computers since the early 1980s (his first computer was a Tandy TRS 80 Model 1 with a massive 4KB of RAM!). One of the web sites he developed presented the world's first radio station licensed by the music copyright holders. In order to enable people to continue to surf while listening, Robin also developed the first known pop-up windows. He has also worked full time for one of Britain's main IT magazine publishers, where he held several roles including editorial, promotions, and cover disc editing.
Excerpt. © Reprinted by permission. All rights reserved.
The World Wide Web is a constantly evolving network that has already traveled far beyond its conception in the early 1990s, when it was created to solve a specific problem. State-of-the-art experiments at CERN (the European Laboratory for Particle Physics--now best known as the operator of the Large Hadron Collider) were producing incredible amounts of data--so much that the data was proving unwieldy to distribute to the participating scientists who were spread out across the world.
At this time, the Internet was already in place, with several hundred thousand computers connected to it, so Tim Berners-Lee (a CERN fellow) devised a method of navigating between them using a hyperlinking framework, which came to be known as Hyper Text Transfer Protocol, or HTTP.
He also created a markup language called HTML, or Hyper Text Markup Language. To bring these together, he wrote the first web browser and web server, tools that we now take for granted.
But back then, the concept was revolutionary. The most connectivity so far experienced by at-home modem users was dialing up and connecting to a bulletin board that was hosted by a single computer, where you could communicate and swap data only with other users of that service.
Consequently, you needed to be a member of many bulletin board systems in order to effectively communicate electronically with your colleagues and friends.
But Berners-Lee changed all that with one fell swoop, and by the mid 1990s, there were three major graphical web browsers competing for the attention of five million users.
It soon became obvious, though, that something was missing. Yes, pages of text and graphics with hyperlinks to take you to other pages was a brilliant concept, but the results didn't reflect the instantaneous potential of computers and the Internet to meet the particular needs of each user with dynamically changing content. Using the Web was a very dry and plain experience, even if we did now have scrolling text and animated GIFs!
Shopping carts, search engines, and social networks have clearly altered how we use the Web. In this chapter, we'll take a brief look at the various components that make up the Web, and the software that helps make it a rich and dynamic experience.
HTTP and HTML: Berners-Lee's Basics
HTTP is a communication standard governing the requests and responses that take place between the browser running on the end user's computer and the Web server. The server's job is to accept a request from the client and attempt to reply to it in a meaningful way, usually by serving up a requested web page--that's why the term server is used.
The natural counterpart to a server is a client, so that term is applied both to the web browser and the computer on which it's running.
Between the client and the server there can be several other devices, such as routers, proxies, gateways, and so on. They serve different roles in ensuring that the requests and responses are correctly transferred between the client and server. Typically, they use the Internet to send this information.
A web server can usually handle multiple simultaneous connections and--when not communicating with a client--spends its time listening for an incoming connection. When one arrives, the server sends back a response to confirm its receipt.
The Request/Response Procedure
At its most basic level, the request/response process consists of a web browser asking the web server to send it a web page and the server sending back the page. The browser then takes care of displaying the page
On the server side, progress was being made on the Common Gateway Interface (CGI) using scripting languages such as Perl (an alternative to the PHP language) and server0side scripting--inserting the contents of one file (or the output of a system call) into another one dynamically.
Under Ajax, web pages perform data handling and send requests to web servers in the background--without the web user being aware that this is going on.
No doubt the symbiotic nature of PHP and MySQL helped propel them both forward, but what attracted developers to them in the first place?
The simple answer has to be the ease with which you can use them to quickly create dynamic elements on websites. MySQL is a fast and powerful, yet easy-to-use database system that offers just about anything a website would need in order to find and serve up data to browsers.
When PHP allies with MySQL to store and retrieve this data, you have the fundamental parts required for the development of social networking sites and the beginnings of Web 2.0.