DB.php and Its Use in This Book
In recipes where database access is required, I use DB.php to
access the database. DB.php is used only in PHP 4, and is not fully
mature at the time of writing, so I decided not to
The History of PHP
PHP, like many great things, arose out of necessity. Rasmus Lerdorf wrote the initial version of PHP in an afternoon, during a period between contracts when he needed a quick tool to track users who were reading his online resume. However, the initial PHP, a Perl/CGI wrapper, was experiencing growing pains on the Web server where his resume was located. So, Rasmus decided to rewrite the Perl wrapper in C to eliminate the overhead of forking Perl each time his resume was accessed.
After some time, people who were on the same Web server noticed Rasmus' wrapper and asked him if they could use it, and the rest is history. As more people used his wrapper, they asked for more features, which made more people want to use the wrapper.
Finally, Rasmus decided to put together a somewhat complete distribution along with documentation, a mailing list, and a FAQ. This first distribution was called Personal Home Page Tools, which later transformed into the Personal Home Page Construction Kit.
While Rasmus was working on PHP, he also was working on a tool to embed SQL queries easily into a Web page. In the most basic sense, it was another CGI wrapper that parsed SQL queries and made it easy to create forms and tables based on those queries. The
PHP/FI 2.0 was a rebirth of both PHP and FI rewritten into one program. PHP/FI was an easy programming language rather than a simple CGI wrapper. It enabled programmers to embed simple scripts directly into a Web page.
PHP/FI became quite popular among developers, and it caught the eye of Andi Gutmans and Zeev Suraski, who ”although they
PHP 3 was a huge improvement over PHP/FI. It featured better performance, cleaner syntax, object-oriented support, the for loop, and many other improvements. PHP 3 has enjoyed incredible success. According to the latest Netcraft survey, PHP 3 is by far the most popular Apache server module, installed on more than 1.5 million Web servers.
Enter PHP 4
The PHP 3 engine, although extremely popular and sufficiently
fast, was starting to suffer from growing pains as more and more
people used it for increasingly complex applications. Therefore,
The result of that rewrite is the Zend engine (named after Zeev
and Andi). The Zend engine is the
One of the greatest features in PHP 4 is the performance boost it gives over PHP 3. Tests (available from Zend) show that the same scripts run with PHP 4 instead of PHP 3 show a 50 “1,000% performance increase. You can also use PHP 4 with the free Zend Optimizer (available from Zend Technologies, http://www.zend.com/), which gives PHP 4 an additional 40 “100% speed boost. How much of a speed improvement you get depends on the structure of your scripts.