Hudzilla.org - the homepage of Paul Hudson
Contents > Introducing PHP > History Wish List | Report Bug | About Me ]

2.1.2     Early versions of PHP

This is NOT the latest copy of this book; click here for the latest version.

The original release of PHP was designed and created by Rasmus Lerdorf back in the middle of the 90s as a way of making various common web tasks easier and less repetitive. Back then, the main goal was to have the minimum amount of logic as was possible in order to achieve results, and this led to PHP being HTML-centric - that is, PHP code was embedded inside HTML.

The first popular version of PHP was called PHP/FI 2.0, for Personal Home Page / Form Interpreter, and, despite its parsing inconsistencies, managed to attract a fair few converts, including myself. The main issue with this version was that the PHP/FI parser was largely hand-written, and so users often encountered scripting errors that were not technically errors - they were just the PHP/FI parser screwing up. Furthermore, the parser was absolutely tied to the Apache web server, and was hardly renowned for its speed.

Author's Note: The parser is what takes your script and converts it to something the computer can understand. It comes from the word "parse", which means to break text up into components and analyse them.

Some of these issues were resolved in version 3, when Zeev Suraski and Andi Gutmans re-wrote PHP from the ground up using standard "compiler compiler" tools like Flex and Bison. This made the parser itself all but bulletproof, which in turn gave sanity back to many PHP users!

PHP 3 also finally made the language extensible - something that was seriously lacking from prior versions. Particularly keen developers were able to write their own modules for the language, adding functionality at the core level. The parser itself, though, was still tied to Apache, and, although speed was improved a great deal from PHP/FI, it still was not anything to shout about.

The only downside to upgrading to PHP 3 was that the language was a lot stricter - some code that worked on PHP/FI would no longer work after upgrading. The language was still young, though, so not many were affected.

The all-round improvement brought about by the PHP/FI to PHP 3 upgrade brought in many new users eager to jump from the Perl ship to a system that was easier to use. At the time, there was no doubt at all that Perl was faster to execute, except perhaps among PHP zealots, however PHP still kept its lead in speed of development, and that was the key selling point.

With PHP 3, the language had gained limited object-oriented support, and this only added extra fuel to the fire of PHP's growth. By the time PHP 3 was replaced in the middle of 2000, it was installed on over 2,500,000 web-site domains, as compared to 250,000 just 18 months before.

In the middle of 2000, PHP 4 was released to the world, containing major differences to PHP 3 in all aspects. Extensive work had been done to ensure that backwards compatibility with older PHP scripts would remain - upgrading from PHP 3 to PHP 4 was much smoother than the PHP/FI to PHP 3 upgrade.

Perhaps the most important change made for PHP 4 was the switch to what is called the Zend Engine. The Zend Engine, created by Zend, a company founded by Zeev Suraski and Andi Gutmans (the name Zend is a contraction of ZEev and aNDi) to promote PHP in the corporate environment, allowed much more flexibility than had ever been seen before in PHP. The engine took over the core of PHP and introduced reference counting, whereby all resources used in scripts (database connections, files, etc) are tracked automatically by the engine, and freed when no longer used to minimise memory usage and ensure there were no memory leaks.

Also introduced with PHP 4 was complete web server abstraction, meaning that PHP now runs on Apache 1.3.x, Apache 2, Microsoft's IIS, Zeus, AOLServer, and more. This opened use of the language up to the 40% of the world who do not use Apache for their web server.

Performance took a gigantic leap forward due to two main factors. Firstly, PHP the execution paradigm was changed from prior versions. PHP 3 and before used an "execute while interpreting" paradigm which meant that PHP read a line of source code, interpreted it, executed it, read another, interpreted it, executed it, read another, etc. This meant that code was often re-read and re-interpreted twice or more, entirely unnecessarily.

PHP 4, with its new "compile first, execute later" paradigm read your entire script in and compiled it to byte code before execution, which produced a large speed increase - the average speed increase was about 100%, with some benchmarks showing up to a fifty-fold increase in speed when PHP 4 was pushed to its limits.

Author's Note: "Byte code" is the name for the internal representation of your script that PHP can understand easily - it is usually a lot longer than your script as a result of each PHP statement being broken down into many simple byte code statements.

Furthermore, because PHP 4 compiled the entire script before executing it, it became possible to optimise and cache the compiled code before execution. We will be looking at how this works later on in the book.

Secondly, PHP 4 introduced multi-threading, which essentially allows particularly lengthy, but non-critical functions to be run independently from the main script process, further streamlining execution.

Since the release, PHP has continued its advance unabated - at the time of writing, the current version of PHP 4 is 4.3.9, and PHP is installed on 9,500,000 web servers around the world. PHP is the most popular Apache module available, surpassing even mod_perl, and continues to grow in popularity.





<< 2.1.1 Background   2.1.3 Current release >>
Table of Contents
Want to see this stuff in print? PHP in a Nutshell takes the core topics covered here, adds in thousands of edits from the editorial team and myself, and combines them to make an unbeatable reference for PHP programmers at all levels.



My latest book has hundreds more tips on how to use PHP, Apache, and MySQL, plus Perl, Python, shell scripts, performance tuning, and more!



Top-right shadow
 
Bottom-left shadow Bottom shadow

Comments from other readers
ME - 13 Oct 2008

I am a PHP newbie, and this book is awesome. I see your point in not publishing it in PDF format, think of the work involved, and with no compensation! Some people want the world handed to them on a silver platter.

ackanis@rediffmail.com - 13 Oct 2008

i want to download this book , but since pdf format is not available i cant do anything except clicking on every page. pls provide pdf format free of cost.

A PHP User - 13 Oct 2008

i want to download this book foe my brother , but since pdf format is not available i cant do anything except clicking on every page. pls provide pdf format free of cost.
krishnanand mishra
research fellow

A PHP User - 13 Oct 2008

am okey

caf178@yahoo.com - 13 Oct 2008

Go ahead Paul, it's great what you are doing for world's technology.

caf178@yahoo.com - 13 Oct 2008

Go ahead Paul, it's great what you are doing for world's technology.

caf178@yahoo.com - 13 Oct 2008

Go ahead Paul, it's great what you are doing for world's technology.

A PHP User - 13 Oct 2008

I want to thanks for your interest in making impact in the world by passing your wealth of knowledge to people like u. i want to know, if this book can be put in a pdf format and make more simpler for us to understand. Thanks and God bless you.

amrahsjar2@gmail.com - 13 Oct 2008

I would be minded to agree with rudrajyoti.biswas@gmail.com but for the simple reason that keeping it in HTML format goes to serve two purposes:

1. The information remains up-to-date.

2. Paul Hudson would continue to earn for print version :-)

Many thanks for the favour of giving this book free.

Raj Sharma

rudrajyoti.biswas@gmail.com - 13 Oct 2008

if you are reallu allowing people to read the php books free of cost in html format , then why dont you publish the book in a pdf format free in net.
this would have been definitely helpful for students like us who are really intesrested in learning php.
please consider my request and try to publish the book in a free downloadable format.
thank you

A PHP User - 13 Oct 2008

ΪʲôÆÀÂÛµÄÈËÕâôÉÙ£¿
why ?
flowinglx@163.com

A PHP User - 13 Oct 2008

ΪʲôÆÀÂÛµÄÈËÕâôÉÙ£¿
why ?
flowinglx@163.com

A PHP User - 13 Oct 2008

<at the time of writing, the current version of PHP 4 is 4.3.9>

Please update this fragment...

A PHP User - 13 Oct 2008

8+0



Add comment
Please note that by posting a comment here you are committing it to the public domain. This is important so that others can make use of your code themselves, and also so that I can incorporate helpful notes directly into the main text. Comments are limited to 2000 characters in length.

If you are reporting an error in the content, please tell me directly.

Your name/email address:
Your comment:
 
Now, in order to verify that you're a real person, please answer this simple question: what is eight plus five?
The answer is:
(please write in
numbers, eg 19)


Top-right shadow
 
Bottom-left shadow Bottom shadow