PHP is a programming language designed to generate web pages interactively on the computer serving them, called a web server . Unlike HTML, where the web browser uses tags and markup to generate a page, PHP code runs between the requested page and the web server, adding to and changing the basic HTML output.
For example, PHP code could be used to display a counter of visitors to a site. PHP, in less than 20 lines of code, can store the IP address from which a page request comes in a separate file, and then display the number of unique IP addresses that visited a particular site.
The person requesting the web page doesn't know that PHP generated the page, because the counter text is part of the standard HTML markup language that the PHP code generated. PHP makes web development easy, because all the code you need is contained within the PHP framework.
This means that there's no reason for you to reinvent the wheel each time you sit down to develop a PHP program; that would be something you'd have to do if you were using a compiled language like C. While PHP is great for developing web functionality, it is not a database.
The database of choice for PHP developers is MySQL, which acts like a filing clerk for PHP-processed user information. MySQL automates the most common tasks related to storing and retrieving specific user information based on your supplied criteria.
MySQL is easily accessed from PHP, and they're commonly used together as they work well hand in hand. An added benefit is that PHP and MySQL run on various computer types and operating systems, including Mac OS X, Windows-based PCs, and Linux.
There are several factors that make using PHP and MySQL together a natural choice:
- PHP and MySQL work well together. PHP and MySQL have been developed with each other in mind, so they are easy to use together. The programming interfaces between them are logically paired up. Working together wasn't an afterthought when the developers created the PHP and MySQL interfaces.
- PHP and MySQL have open source power. As they are both open source projects, PHP and MySQL can both be used for free. MySQL client libraries are no longer bundled with PHP. Advanced users have the ability to make changes to the source code, and therefore, change the way the language and programs work.
- PHP and MySQL have community support. There are active communities on the Web in which you can participate and they'll answer your questions. You can also purchase professional support for MySQL if you need it.
- PHP and MySQL are fast. Their simplicity and efficient design enables faster processing.
- PHP and MySQL don't bog you down with unnecessary details. You don't need to know all of the low-level details of how the PHP language interfaces with the MySQL database, as there is a standard interface for calling MySQL procedures from PHP. Online APIs at www.php.net offer an unlimited resource.
As we mentioned above, both PHP and MySQL are open source projects, so there's no need to worry about user licenses for every computer in your office or home.
In open source projects and technologies, programmers have access to the source code; this enables individual or group analysis to identify potentially problematic code, test, debug, and offer changes as well as additions to that code.
For example, Unixthe forerunner in the open source software communitywas freely shared with university software researchers. Linux, the free alternative to Unix, is a direct result of their efforts and the open source licensing paradigm.