Technology

PHP Creator Rasmus Lerdorf Shares Lessons Learned from the Last 25 Years

8 Sep 2019 6:00am, by

Rasmus_Lerdorf_August_2014_(cropped) by William Stadtwald Demchick via Wikipedia

This year’s annual phpDay Italian PHP conference in Verona ended with a surprisingly reflective talk from the original creator of PHP.

As the closing speaker, 50-year-old Rasmus Lerdorf looked back over the web backend programming language’s last 25 years, and offered some lessons learned from the evolution of a humble hypertext preprocessor into a major player in the infrastructure of the web.

But besides sharing his stories about a lifetime in tech and the changes that rocked our world, Lerdorf also offered his own perspective on what it all had meant, and even some good advice for newer generations of hopeful young hackers who might also want to change the world themselves.

What Changed Everything

Lerdorf began by sharing some memories from the 1980s. At one point he even showed a slide of his Timex Sinclair 1000 home computer, and remembered the days of dial-up modems, and using the old Gopher protocol to retrieve online research papers. “That was as close to the web as I ever saw in university.”

But it was the first Mosaic web browser in 1994 that got him going. “This changed everything,” Lerdorf told the audience emphatically. “And not just for me, for everybody… Everybody around at the time, playing with this stuff, and having had UUCP addresses and playing with Usenet and bulletin boards — it was very easy to see that this was going to change the world.”

Though he describes himself as “a mediocre coder” who doesn’t particularly like programming, Lerdorf had hacked together a set of C binaries that formed a useful set of tools for simplifying some of the basic functions for webmasters, including a nicely-formatted access log and the ability to add server-generated content into webpages.

His ultimate idea was to have a template parsing system for tags that would correspond to small C functions that the users could write themselves. He thought it would prove to be popular, but “I was completely wrong. Nobody wanted to write C code.” People would email him requesting additional tags, and he’d try to demonstrate how easy it was to write them yourself. He’d email back the simple C code they’d need, “And they would say thank you. And then say, ‘Now we need this one. We can’t figure out how to do this one.’ And I would do it.

“And they would trick me into building their site, basically.”

Webysther_20160423_-_Elephpant mascot by Vincent Pontier (via Wikipedia)

One slide had the heading “What Was He Thinking?” which Lerdorf describes as “some of the things over the years that people keep asking me about.”

First up? Why does PHP use case-insensitive function names? “It doesn’t make a whole lot of sense today, but for all of these decisions, you have to take the context in mind… When the web first started, there was a huge religious battle on whether HTML tags should be uppercase, lowercase, or even mixed case. Because my templating system wanted to fit in this world, I didn’t want to take sides…

creenshot-from-25-years-of-php-rasmus-lerdorf-talk-at-phpdays-2019-what-was-he-thinking

“Now when everybody did finally sort of get to lowercase, I probably should’ve switched it. But I remember thinking, ‘This will affect hundreds of sites…'”

Then he laughs as he admits candidly to his audience that “Looking back now, it’s like, ‘I should have inconvenienced a couple hundred sites at the time.”

In A World Without Containers

A quarter of a century later, Lerdorf still remembers how innocent that decision had seemed at the time. “I had absolutely no idea… At every point along the way, I figured there were about six months of life left in PHP. Because that’s about the amount of time I thought it would take for somebody to write something real that could replace it, that also would work for me. And I kept waiting… And nothing did.”

It’s a point he reiterates later in his talk. “I could never have imagined I’d still be talking about this thing 25 years later.”

He also remembers a critical milestone: when the Apache web server began shipping with PHP. Other languages were actually faster than PHP, but the overhead of launching them as a separate process made PHP seem faster by comparison.” And Lerdorf tells an only-in-the-1990s story about the day when Perl finally also released its own optional embeddable module for Apache web servers — mod_perl. “They’d made it way too powerful… If you were on the virtual host on an Apache server, and you had mod_perl access, you could steal the requests from every other virtual host if you wanted to…” Because of this vulnerability, ISPs wouldn’t offer mod_perl alongside other clients in a single Apache instance.

“So if you came to an ISP and said ‘I would like mod_perl‘, they would say, ‘Okay, that’ll be $600 a month,’ because back then, we also didn’t have VMs, containers, anything like that. So you had to have a separate, physical bare metal box for mod_perl. Whereas on PHP, you could put 3,000 customers on one machine, versus one mod_perl customer.”

What I Learned on My Internship

Lerdorf also tells a fascinating story of his pre-PHP days, describing an internship at Nortel Telecom in Toronto — and how it directly influenced the way he’d designed PHP. Every couple of months the company’s call-routing system would drop every single call from its queue — a bug that they’d never been able to fix. “They tried finding it for years, and they didn’t see it.” So they’d asked young Lerdorf to look into it. Decades later he sees his assignment — fixing that unfixable bug — as a kind of joke. “They didn’t think I would get anywhere. They figured I would learn the system from trying to track it down.”

Lerdorf had printed out every line of the source code, and taped it all up to the walls of the hallways, tracking its flow and trying to debug it manually. “I had a chair I could stand on to reach the higher things.” He remembers the code as “nasty,” but reports what he’d learned.

“In the end, after three and a half months, it turned out to be a global variable collision. Two separate pieces of the code, completely unrelated, had the same name for a variable. And it was global. Changed in one place at exactly the wrong time, it would cause this other code to go crazy. And the C compiler at the time had no way of informing us that that was happening…”

“When I started adding variables and scope to PHP, I remembered that. And there was no way that in PHP, I was going to be spending three and a half months tracking down something like this… So in PHP, if you’re going to step on the global, you have to damn well declare the fact inside the method or a function, that you’re going to step on the global… So you can’t accidentally step on the global in PHP.”

Asking for a show of hands, Lerdorf was surprised by how many people were still running PHP 5. “You’re killing me…” he said with a laugh. “I was expecting maybe one or two hands to go up. But the whole back of the room lit up!”

And then he patiently walked the audience through all the improvements of PHP 7.3. For instance, version 5.3 needed 140MB to serve up WordPress, but version 7.3 needs just 15MB.

A Thoughtful Look Backwards

But Lerdoff’s talk ended with an inspiring conclusion. He fondly remembered a visit to Sri Lanka in 2005 — and not just because it’s the year when he met Arthur C. Clarke. It was the year after a massive earthquake and tsunami, leading to a disaster relief project called Sahana. “I talked to the folks there when I was there, and talked through some of the things that they could do with PHP…”

And ultimately a team which he describes as “a kid at the university and also a guy working for the government” used PHP to put together what Lerdorf calls “a disaster-relief in-a-box management type system.” It allows the quick dissemination of information about relief supplies — or about the status of missing persons. “There are seven, eight, nine different modules like that. And the value is that this can be spun up in three minutes… And it has been used now in 50+ disasters around the world.

“Knowing that PHP has literally, probably saved someone’s life, makes all that online grief completely irrelevant…”

While some people follow that progression naturally, he believes others do it “because they don’t feel like they can keep up… Which is kind of code for, they’ve lost interest. They’re not motivated enough to actually sit and read about things in the evenings.” But even with the constraints of a family, there should still be time for a passion and a motivation, Lerdorf believes, and “If you don’t have that, you will burn out.”

He shares a quote from the national secretary of defense of the Phillippines — that “No innovation matters more than one which saves lives.”

“We can’t lose track of what we’re doing here, and why we’re programming. We’re programming to solve a problem. And hopefully, it’s a problem that actually matters.

“So work on things that matter to you. Please.”


WebReduce

Feature image: Rasmus Lerdorf, August 2014 (cropped), by William Stadtwald Demchick via Wikipedia.

A newsletter digest of the week’s most important stories & analyses.

View / Add Comments

Please stay on topic and be respectful of others. Review our Terms of Use.