Programming PHPProgramming PHPSearch this book

1.2. A Brief History of PHP

Rasmus Lerdorf first conceived of PHP in 1994, but the PHP that people use today is quite different from the initial version. To understand how PHP got where it is today, it is useful to know the historical evolution of the language. Here's that story, as told by Rasmus.

1.2.1. The Evolution of PHP

Here is the PHP 1.0 announcement that I posted to the Usenet newsgroup comp.infosystems.www.authoring.cgi in June 1995:

From: rasmus@io.org (Rasmus Lerdorf)
Subject: Announce: Personal Home Page Tools (PHP Tools)
Date: 1995/06/08
Message-ID: <3r7pgp$aa1@ionews.io.org>#1/1
organization: none
newsgroups: comp.infosystems.www.authoring.cgi
Announcing the Personal Home Page Tools (PHP Tools) version 1.0.
These tools are a set of small tight cgi binaries written in C.
They perform a number of functions including:
. Logging accesses to your pages in your own private log files
. Real-time viewing of log information
. Providing a nice interface to this log information
. Displaying last access information right on your pages
. Full daily and total access counters
. Banning access to users based on their domain
. Password protecting pages based on users' domains
. Tracking accesses ** based on users' e-mail addresses **
. Tracking referring URL's - HTTP_REFERER support
. Performing server-side includes without needing server support for it
. Ability to not log accesses from certain domains (ie. your own)
. Easily create and display forms
. Ability to use form information in following documents
Here is what you don't need to use these tools:
. You do not need root access - install in your ~/public_html dir
. You do not need server-side includes enabled in your server
. You do not need access to Perl or Tcl or any other script interpreter
. You do not need access to the httpd log files
The only requirement for these tools to work is that you have
the ability to execute your own cgi programs.  Ask your system
administrator if you are not sure what this means.
The tools also allow you to implement a guestbook or any other
form that needs to write information and display it to users
later in about 2 minutes.
The tools are in the public domain distributed under the GNU
Public License.  Yes, that means they are free!
For a complete demonstration of these tools, point your browser
at: http://www.io.org/~rasmus
--
Rasmus Lerdorf
rasmus@io.org
http://www.io.org/~rasmus

Note that the URL and email address shown in this message are long gone. The language of this announcement reflects the concerns that people had at the time, such as password-protecting pages, easily creating forms, and accessing form data on subsequent pages. The announcement also illustrates PHP's initial positioning as a framework for a number of useful tools.

The announcement talks only about the tools that came with PHP, but behind the scenes the goal was to create a framework to make it easy to extend PHP and add more tools. The business logic for these add-ons was written in C—a simple parser picked tags out of the HTML and called the various C functions. It was never my plan to create a scripting language.

So, what happened?

I started working on a rather large project for the University of Toronto that needed a tool to pull together data from various places and present a nice web-based administration interface. Of course, I decided that PHP would be ideal for the task, but for performance reasons, the various small tools of PHP 1 had to be brought together better and integrated into the web server.

Initially, I made some hacks to the NCSA web server, to patch it to support the core PHP functionality. The problem with this approach was that as a user, you had to replace your web-server software with this special, hacked-up version. Fortunately, Apache was starting to gain momentum around this time, and the Apache API made it easier to add functionality like PHP to the server.

Over the next year or so, a lot was done and the focus changed quite a bit. Here's the PHP Version 2 (PHP/FI) announcement I sent in April 1996:

From: rasmus@madhaus.utcs.utoronto.ca (Rasmus Lerdorf)
Subject: ANNOUNCE: PHP/FI Server-side HTML-Embedded Scripting Language
Date: 1996/04/16
Newsgroups: comp.infosystems.www.authoring.cgi
PHP/FI is a server-side HTML embedded scripting language.  It has built-in
access logging and access restriction features and also support for
embedded SQL queries to mSQL and/or Postgres95 backend databases.
It is most likely the fastest and simplest tool available for creating 
database-enabled web sites.
It will work with any UNIX-based web server on every UNIX flavour out
there.  The package is completely free of charge for all uses including
commercial.
Feature List:
. Access Logging
  Log every hit to your pages in either a dbm or an mSQL database.
  Having hit information in a database format makes later analysis easier.
. Access Restriction
  Password protect your pages, or restrict access based on the refering URL
  plus many other options.
. mSQL Support
  Embed mSQL queries right in your HTML source files
. Postgres95 Support
  Embed Postgres95 queries right in your HTML source files
. DBM Support
  DB,DBM,NDBM and GDBM are all supported
. RFC-1867 File Upload Support
  Create file upload forms
. Variables, Arrays, Associative Arrays
. User-Defined Functions with static variables + recursion 
. Conditionals and While loops
  Writing conditional dynamic web pages could not be easier than with
  the PHP/FI conditionals and looping support
. Extended Regular Expressions
  Powerful string manipulation support through full regexp support
. Raw HTTP Header Control
  Lets you send customized HTTP headers to the browser for advanced 
  Features such as cookies.
. Dynamic GIF Image Creation
  Thomas Boutell's GD library is supported through an easy-to-use set of
  tags.
It can be downloaded from the File Archive at: <URL:http://www.vex.net/php>
--
Rasmus Lerdorf
rasmus@vex.net

This was the first time the term "scripting language" was used. PHP 1's simplistic tag-replacement code was replaced with a parser that could handle a more sophisticated embedded tag language. By today's standards, the tag language wasn't particularly sophisticated, but compared to PHP 1 it certainly was.

The main reason for this change was that few people who used PHP 1 were actually interested in using the C-based framework for creating add-ons. Most users were much more interested in being able to embed logic directly in their web pages for creating conditional HTML, custom tags, and other such features. PHP 1 users were constantly requesting the ability to add the hit-tracking footer or send different HTML blocks conditionally. This led to the creation of an if tag. Once you have if, you need else as well. And from there, it's a slippery slope to the point where, whether you want to or not, you end up writing an entire scripting language.

By mid-1997, PHP Version 2 had grown quite a bit and had attracted a lot of users, but there were still some stability problems with the underlying parsing engine. The project was also still mostly a one-man effort, with a few contributions here and there. At this point, Zeev Suraski and Andi Gutmans in Tel Aviv volunteered to rewrite the underlying parsing engine, and we agreed to make their rewrite the base for PHP Version 3. Other people also volunteered to work on other parts of PHP, and the project changed from a one-person effort with a few contributors to a true open source project with many developers around the world.

Here is the PHP 3.0 announcement from June 1998:

June 6, 1998 -- The PHP Development Team announced the release of PHP 3.0,
the latest release of the server-side scripting solution already in use on
over 70,000 World Wide Web sites.
This all-new version of the popular scripting language includes support
for all major operating systems (Windows 95/NT, most versions of Unix,
and Macintosh) and web servers (including Apache, Netscape servers,
WebSite Pro, and Microsoft Internet Information Server).
PHP 3.0 also supports a wide range of databases, including Oracle, Sybase, Solid, 
MySQ, mSQL, and PostgreSQL, as well as ODBC data sources.
New features include persistent database connections, support for the
SNMP and IMAP protocols, and a revamped C API for extending the language
with new features.
"PHP is a very programmer-friendly scripting language suitable for
people with little or no programming experience as well as the
seasoned web developer who needs to get things done quickly.  The
best thing about PHP is that you get results quickly," said
Rasmus Lerdorf, one of the developers of the language.
"Version 3 provides a much more powerful, reliable and efficient
implementation of the language, while maintaining the ease of use and 
rapid development that were the key to PHP's success in the past", 
added Andi Gutmans, one of the implementors of the new language core.
"At Circle Net we have found PHP to be the most robust platform for
rapid web-based application development available today," said Troy
Cobb, Chief Technology Officer at Circle Net, Inc.  "Our use of PHP
has cut our development time in half, and more than doubled our client
satisfaction.  PHP has enabled us to provide database-driven dynamic
solutions which perform at phenomenal speeds."
PHP 3.0 is available for free download in source form and binaries for
several platforms at http://www.php.net/.
The PHP Development Team is an international group of programmers who
lead the open development of PHP and related projects.
For more information, the PHP Development Team can be contacted at
core@php.net.

After the release of PHP 3, usage really started to take off. Version 4 was prompted by a number of developers who were interested in making some fundamental changes to the architecture of PHP. These changes included abstracting the layer between the language and the web server, adding a thread-safety mechanism, and adding a more advanced, two-stage parse/execute tag-parsing system. This new parser, primarily written by Zeev and Andi, was named the Zend engine. After a lot of work by a lot of developers, PHP 4.0 was released on May 22, 2000.

Since that release, there have been a few minor releases of PHP 4, with the latest version as of this writing being 4.1.1. As this book goes to press, there is talk of PHP Version 5, which is likely to improve the internals of PHP's object system.

1.2.2. The Growth of PHP

Figures 1-1 and 1-2 show the growth of PHP as measured by the usage numbers collected by Netcraft (http://www.netcraft.com) since early 1998. Figure 1-1 shows the total number of unique IP addresses that report they are using Apache with the PHP module enabled. In November 2001, this number went beyond the one-million mark. The slight dip at the end of 2001 reflects the demise of a number of dot-coms that disappeared from the Web. The overall number of servers that Netcraft found also went down for the first time during this period.

Figure 1-1

Figure 1-1. The growth of PHP IP addresses

Figure 1-2 shows the number of actual domains that report they are using the PHP module. In November 2001, when Netcraft found 36,458,394 different domains, 7,095,691 ( just under 20%) of them were found to have PHP enabled. The domain figures represent the number of web sites using PHP, whereas IP addresses represent the number of physical servers running PHP.

Figure 1-2

Figure 1-2. The growth of PHP domains



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.