Information Technology Reference
In-Depth Information
15
1. A visitor's web browser calls on a page from your site.
2. The web server sees a PHP script on the requested page and fires up its PHP interpreter
( mod_php5 in Apache) to execute the code.
3. Some of those PHP commands allow the script to connect to the MySQL database as the
WordPress user and ask the database for the content that belongs on the page.
4. The MySQL database retrieves the requested content and sends it back to the PHP script (more
precisely, to the page it's on).
5. The script, in turn, pours all of this content into a few variables.
6. The script then echoes the content from the variables for display on the page.
7. The script combines the database content with any plain HTML included on the requested page
and hands it back to the web server.
8. The web server sends the HTML page back to the browser.
9. The visitor (ideally) becomes enlightened, entertained, enthralled, or some combination thereof.
She tells you so on the comments page, beginning the process over again.
Figure 15.3
How PHP and MySQL
work together to make
a web page.
MySQL
Request
Content
Send
Content
Send HTML
Output
Apache
Web Server
Web
Browser
PHP
Run Script
Request
Page
PHP Script
Why store your content in a database when it's just text? Isn't it just easier to have this material
surrounded with some variant of HTML or XML tags? When you think about a blog as a moving tar-
get, a combination of static and dynamic elements, the answer becomes apparent rather quickly.
Maintaining a blog full of static posts quickly becomes a logistical nightmare.
Coming up with enough blog content to keep people visiting can be hard enough without having to
continually think about how many posts should be on the front page, making individual perma-
linked pages for each of your posts, and all the comments people make on them. This is a job ripe
for automation, and the best way to automate content delivery is by keeping your data in one easily
accessed place.
Search WWH ::




Custom Search