Information Technology Reference
In-Depth Information
IV
The core WordPress software is written in PHP. Themes con-
sist of PHP templates and CSS styles. Plug-ins can be written
in PHP exclusively, or can include code from other languages
(such as JavaScript), but need to be able to hook into
WordPress to provide the necessary functionality. That is
done using PHP as well.
Every bit of content in your blog—posts, sidebars,
stylesheets, comments, graphics, dashboard, and all the
rest—is stored in the MySQL database you set up during your installation (or that WordPress.com
set up for you when you launched your hosted blog). What happens when your site has a visitor?
In a matter of seconds, all this goes on, as in Figure 11.1:
note
There is no shortage of topics to
help you learn PHP and MySQL
together. Julie C. Meloni's PHP,
MySQL and Apache All in One will
get you off to a great start.
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 11.1
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
Search WWH ::




Custom Search