Dynamic Web Pages with PHP3
An Embedded Scripting Language for the Web
By Rasmus Lerdorf
PHP is a freely available, HTML-embedded scripting language that lets
you embed special tags to create your script right in an HTML file. PHP
can be integrated into the Web server itself, eliminating the need to start
up a separate CGI program to generate the Web page, which can lead to dramatic
performance increases on some systems. In this article, I'll describe how
PHP came into existence, introduce some PHP basics, then share some useful,
instructive scripts to get you started.
PHP3 History
PHP began as a simple CGI wrapper written in Perl that I used to keep track
of who had accessed my online resume. I then rewrote the wrapper in C to
speed it up and use less resources. At the same time, I needed a way to
glue my home page to a database, so I wrote the Form Interpreter (FI),
a tool to embed SQL queries inside Web pages and handle form input. These
tools were never intended for public use, but as so often happens, people
who saw my Web pages asked for a copy of what I was using. So, I bundled
up my two tools, named them the Personal Home Page Tools, and added some
documentation; thus was born PHP version 1.0.
The more people used the package, the more features they asked for.
I had written a small, simple macro-replacement filter, but people wanted
conditional macros, loops, and arrays, which called for a complete language
parser. I read all I could find on YACC and GNU Bison (automatic parser-generation
software) and created a simple parser that supports variables, arrays,
math-operator precendence, conditionals, and more.