|PHP At 20|
|Written by Kay Ewbank|
|Friday, 19 June 2015|
As the alpha of PHP 7.0.0 is announced, it’s worth contemplating that PHP has now reached its twentieth anniversary.
The original announcement of what was then known as Personal Home Page Tools (PHP Tools) version 1.0, back in June 1995, described the tools as a set of small tight cgi binaries written in C.
Only later was the underlying name changed to PHP: Hypertext Preprocessor.
Talking about the tools at the opening keynote at this year’s SunshinePHP conference, Rasmus Lerdorf, the original creator of PHP, told developers attending the conference that his master plan was that the libraries would be a C API for the web, adding that given we’re not all C programmers, this obviously hadn’t happened.
However, while Lerdorf’s master plan hasn’t worked out quite as he intended, PHP has achieved a status that no-one – Lerdorf included – could have imagined. He acknowledged as much in his talk, saying:
“Did I think I’d be here 20 years later talking about this silly little project I did? No, I didn’t.”
It’s worth remembering just how ahead of its time PHP really was. The original library predated HTML 2 by several months, and HTTP 1.0 by almost a year. On the client side, most people browsing the web did so using Netscape Navigator or Mosaic, ahead of the launch of Internet Explorer a couple of months later.
It was the web, Jim, but not as we know it.
As developers, if you wanted to write a web app you struggled when it came to the server-side code. PHP offered a workable solution, to the extent that it now is behind more than 80 per cent of the web. The reasons why this happened are down to the fact that it works.
In the first version, as Lerdorf explain in the 2015 keynote, you got an API that you could use to access lower-level C libraries. You could fill in forms and work with data stored in mSQL, all of which was something that was originally created to maintain Lerdorf’s own homepage.
As Lerdorf explained in 2003 at the ten year anniversary of PHP:
“There was never any intent to write a programming language ... I have absolutely no idea how to write a programming language, I just kept adding the next logical step on the way."
The initial support for mSQL (at the time an important database for web work that was largely superseded by MySQL) was extended by version 2 to include other databases including MySQL, Oracle, PostgreSQL and Sybase. As with so much else of PHP, this was cleverly done to avoid large amounts of coding, by wrapping their libraries in the PHP binary. Similar techniques were used to offer support for GIF images. Version 2 is seen by many developers as the point that PHP really began to make web development achievable. The very fact that PHP seemed so much a simple scripting language encouraged developers to give it a go, where a more sophisticated language would have been off-putting.
This (and the open source nature of PHP, much more a novelty at the time) encouraged many people to help develop the language, and to form and join enthusiastic user groups. Developers who identified problems got on and provided the resources within the language and libraries to solve those problems. Lerdorf posed the question as to why people contribute, and said he thinks it’s a mixture of self-interest (solving their own problems), self-expression, and a desire to improve the world.
As the language increased in popularity, the development push increased, with more tools, and a rewrite of the language parser and core by Zeev Suraski and Andi Gutmans. They formed a company called Zend Technologies, and producing the Zend Engine for PHP 4 by May 2000. In the same year, the developer community launched the PHP Extension and Application Repository (PEAR) to provide a framework and distribution system for reusable PHP components.
The Zend engine was the basis of PHP 5, which added better support for object-oriented code, and the PHP Data Objects (PDO) extension. This gives a consistent way to work with databases, making it easier for developers to swap which database engine they’re using if circumstances change.
Facebook, as a major user of PHP, has influenced the way PHP develops, not by applying direct force but by its own parallel development. For example, as Facebook became so large, it needed an executable version rather than an interpreted one, so developed HHVM, a virtual machine designed for executing programs written in Hack and PHP. HHVM uses a just-in-time (JIT) compilation approach to achieve superior performance while maintaining the development flexibility that PHP provides.
The new version of PHP, version 7, has been influenced by this and other work to find ever faster execution. An experimental PHP branch that was called phpng (PHP next generation) forms the basis of PHP 7. Phpng’s aim was to refactor the Zend Engine without sacrificing language compatibility.
The new alpha release promises greatly improved performance at the levels achieved by HHVM or better. Lerdorf says the new version offers 100 per cent plus performance gain on most real-world applications, along with lower memory usage and native thread local storage. His slide presentation contains some impressive performance graphs to back this up.
To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, Facebook, Google+ or Linkedin, or sign up for our weekly newsletter.
or email your comment to: firstname.lastname@example.org
|Last Updated ( Friday, 19 June 2015 )|