PHP and MySQL work together to help you do what seems like magical things with Web sites. Long ago, way back in the 1994 dark ages of the Internet, a very good thing happened. A genius named Rasmus Lerdorf wanted a way to track how many visitors came to his online resume. So, to count the number of his online resume visitors, Lerdorf created PHP. At that time, PHP stood for Personal Home Page.
Today counting site visitors is something we take for granted, as there are many tools and gizmos available for this common analytic. However, back in 1994 when the Internet was still new, what Rasmus Lerdorf did with his PHP visitor counter was important and new to Web site development. Lerdorf’s PHP would go on to become a very, very powerful and popular web development language. PHP is a rich language for dynamic web development, it has many commands and functions that can perform many different site operations.
PHP is now known as PHP: Hypertext Preprocessor. So what does that mouthful mean? The official PHP Web site (php.net) defines PHP this way;
PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.
PHP is a server-side scripting language designed for use on the Web. This means you can put (or embed) PHP code into an HTML (Hyper Text Markup Language, it’s the code that makes up web pages) web page. Each time the web page is displayed in a browser, the PHP code will run at the web page’s host (PHP runs at the web page’s server) and generate output to the web page which is then shown on the viewer’s (or client’s) browser. Often the generated output shown on a web page by PHP code comes from a database. PHP is very good at interacting with MySQL databases, PHP is often used with the MySQL database management system.
A web developer using PHP will include PHP script/code within the XHTML/HTML code of a web page. The PHP script/code can do many things that make a Web site dynamic, rather than static. A dynamic Web site can change its content, it can change what information is shown to a visitor. A dynamic Web site will usually be powered in the background by a database, such as an MySQL database.
An example of a dynamic Web site would be one where visitors can view, search, and add recipes to an online database, and then display various recipes by calling them up from the database during a search operation. This is all done by the dynamically developed Web site interacting with a visitor. In contrast, a static recipe site would require a web developer to hand-code a new web page for each new recipe added by a visitor.
Blogs are often powered by the WordPress blogging platform, and WordPress uses PHP and an MySQL database to display the content shown in your typical blog. A blog is often updated and changed by adding new posts, which means new data is added to the database powering the blog. Each new post to a blog changes what information is shown, or can be shown, to a visitor.
Updating a dynamic PHP and MySQL developed site is as easy as entering new contents to a database, like when you add a post to a blog. With a dynamic site, no web pages need to be laboriously coded by hand. Dynamic Web sites are easier to maintain, upgrade, and build on than static sites. In contrast, a static Web site requires a Web developer to hand-code each and every web page that has content changes.