News: 1591634704

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

25 years of PHP: The personal web tools that ended up everywhere

(2020/06/08)


Feature On 8th June 1995 programmer Rasmus Lerdorf [1]announced the birth of "Personal Home Page Tools (PHP Tools)".

The PHP system evolved into one that now drives nearly 80 per cent of websites using server-side programming, according to [2]figures from w3techs .

Well-known sites running PHP include every Wordpress site (WordPress [3]claims to run "35 per cent of the web"), Wikipedia and Facebook (with caveats - Facebook uses a number of languages including its own JIT-compiled version of PHP called [4]HHVM ). PHP is also beloved by hosting companies, many of whom provide their customers with [5]PHPMyAdmin for administering MySQL databases.

[People] wanted to do everything in the stupid little templating language I had written, all their business logic

[6]Lerdorf was born in Greenland and grew up in Denmark and Canada. He worked at [7]Yahoo! (a big PHP user) and Etsy. He developed PHP for his own use. "In 1993 programming the web sucked," he said in a 2017 [8]talk .

[9]Youtube Video

It was CGI written in C and "you had to change the C code and recompile even for a slight change," he said.

Perl was "slightly better", Lerdorf opined, but "you still had to write Perl code to spit out HTML. I didn't like that at all. I wanted a simple templating language that was built into the web server."

The Danish-Canadian programmer's original idea was that developers still wrote the bulk of their web application in C but "just use PHP as the templating language." However nobody wanted to write C, said Lerdorf, and people "wanted to do everything in the stupid little templating language I had written, all their business logic."

Lerdorf described a kind of battle with early web developers as PHP evolved, with the developers asking for more and more features while he tried to point them towards other languages for what they wanted to do.

"This is how we got PHP," he said, "a templating language with business logic features pushed into it."

The web's workhorse

Such is the penetration of PHP, which Lerdorf said drives around 2 billion sites on 10 million physical machines, that improving efficiency in PHP 7 had a significant impact on global energy consumption. Converting the world from PHP 5.0 to PHP 7 would save 15B Kilowatt hours annually and 7.5B less carbon dioxide emissions he said – forgetting perhaps that any unused cycles would soon be taken up by machine learning and AI algorithms.

PHP is the workhorse of the web but not fashionable. The language is easy to use but its dynamic and forgiving nature makes it accessible to developers of every level of skill, so that there is plenty of spaghetti code out there, quick hacks that evolved into bigger projects. In particular, early PHP code was prone to SQL injection bugs as developers stuffed input from web forms directly into SQL statements, or other bugs and vulnerabilities thanks to a feature called register_globals that was on by default and which will "inject your scripts with all sorts of variables," according to its [10]own documentation .

There was originally no formal specification for PHP and it is [11]still described as work in progress. It is not a compiled language and object orientation was bolted on rather than being designed in from the beginning as in Java or C# or Ruby. Obsolete versions of PHP are commonplace all over the internet on the basis that as long as it works, nobody touches it. It has become the language that everyone uses but nobody talks about.

"PHP is not very exciting and there is not much to it," [12]said Lerdorf in 2002.

Regularly coming fourth as the most popular language in the [13]Redmonk rankings , PHP has rarely got a mention in the analysis.

That said, PHP has strong qualities that account for its popularity and longevity. Some of this is to do with Lerdorf himself, who has continued to steer PHP with wisdom and pragmatism, though it is a community project with thousands of contributors. It lacks corporate baggage and has always been free and open source. "The tools are in the public domain distributed under the GNU Public License. Yes, that means they are free!" said Lerdorf in the first announcement.

The [14]documentation site is a successful blend of reference and user contributions which means you almost always find something useful there, which is unusual. Most important, PHP is reliable and lightweight, which means it performs well in real-world use even if it does not win in benchmarks.

25 years is a good run and it is not done yet. ®

Sponsored: [15]Modernizing Your .NET Application for Google Cloud Platform



[1] https://groups.google.com/forum/#!msg/comp.infosystems.www.authoring.cgi/PyJ25gZ6z7A/M9FkTUVDfcwJ

[2] https://w3techs.com/technologies/details/pl-php

[3] https://wordpress.org/

[4] https://github.com/facebook/hhvm/

[5] https://www.phpmyadmin.net/

[6] https://twitter.com/rasmus

[7] https://www.theregister.com/2009/11/11/rasmus_lerdorf_leaves_yahoo/

[8] https://www.youtube.com/watch?v=fYTKm2oUzAg

[9] https://www.youtube.com/watch?v=fYTKm2oUzAg

[10] https://www.php.net/manual/en/security.globals.php

[11] https://github.com/php/php-langspec

[12] https://www.sitepoint.com/phps-creator-rasmus-lerdorf/

[13] https://redmonk.com/sogrady/2020/02/28/language-rankings-1-20/

[14] https://www.php.net/manual/en/

[15] https://go.theregister.com/tl/1956/-8473/modernizing-your-net-application-for-google-cloud-platform?td=wptl1956

Thanks Rasmus!

DoctorPaul

Has kept me in work for at least 20 of the 25 :-)

Re: Thanks Rasmus!

DJV

Same here - I was struggling trying to get something working in (Mod-)Perl back in 2000 for the company I worked for at the time. Then my company sent me to the Apache conference in London later that year. At first I went to some Perl and Mod-Perl sessions. Both had low attendance and had people complaining about things that just didn't work - it was all pretty negative. Then I went to a PHP session to find it packed and full of positivity. Upon returning home I ditched (Mod-)Perl, rewrote everything in PHP and it worked! Haven't looked back since!

Yes, there are plenty of ways of doing it wrong in PHP (the way WordPress has been coded being one of them in my opinion - awaits the downvotes!) but doing it right and doing it efficiently is also extremely possible in PHP as well.

Have that wordpress-related upvote.

LeoP

... tile says it all

Charlie Clark

Regularly coming fourth as the most popular language in the Redmonk rankings, PHP has rarely got a mention in the analysis.

Probably because most people using it for their WordPress, et al. websites don't realise it's there. There rarely go beyond choosing a theme and disabling comments: job done really for many people.

PHP really is an awful language. That said, it was probably the right tool at the right time. Initial decisions which were to later cause so many problems were instrumental in this: it ignored the CGI and was quickly available as an Apache module that just streamed to the browser; it quickly got drivers for databases like MySQL and was available for Windows, which made it accessible to new generation of people who learned programming by making their homepages. Being close to C and streaming made it comparatively fast, which made it suitable for websites that were growing quicky and the more websites there were, the more popular the web became. So, kudos to Rasmus and the others who made it work!

Life is like a diaper -- short and loaded.