Wednesday, November 20, 2013

How PHP works

PHP is generally used as a server-side scripting language; it is especially well-suited for creating dynamic
web pages. The scripting language features integrated support for interfacing with databases such as
MySQL, which makes it a prime candidate for building all manner of web applications, from simple
personal web sites to complex enterprise-level applications.
Unlike HTML, which is parsed by a browser when a page loads, PHP is preprocessed by the
machine that serves the document (this machine is referred to as a server). All PHP code contained with
the document is processed by the server before the document is sent to the visitor’s browser.
PHP is a scripted language, which is another great advantage for PHP programmers. Many
programming languages require that you compile files into machine code before they can be run, which
is a time-consuming process. Bypassing the need to compile means you’re able to edit and test code
much more quickly.
Because PHP is a server-side language, running PHP scripts on your local machine requires
installing a server on your local machine, as well. The examples in this book rely on the Apache web
server to deliver your web pages.