The Origins of PHP: The Accidental Language That Runs Much of the Web

Matt George

Fractional CTO · Founder of Injuria.ai

•6 min read•

Most languages in this series were designed. Someone sat down with goals and a philosophy and built toward them. PHP is different. It was never meant to be a language at all. It began as a handful of small tools one developer wrote for himself, and it grew, feature by feature, into something that now powers a large fraction of every website you visit. Understanding PHP means accepting that its greatest strength and its longest-running criticisms come from the same source: it grew instead of being planned.

A personal tool, not a language

In 1994, Rasmus Lerdorf wanted to track who was looking at his online resume. The first version of his Personal Home Page Tools was written in Perl as a simple CGI wrapper, and he soon rewrote it in C to make it faster and lighter on the server.[1] These were not a language. They were a way to add dynamic bits to an otherwise static web page, like a visitor counter or a form handler.

People asked for the code, Lerdorf shared it, and the feature requests kept coming. He folded in a separate tool for handling web forms and talking to databases, and the combination came to be known as PHP/FI, where FI stood for Forms Interpreter.[1] PHP spread not because it was elegant but because it solved the immediate, practical problems of putting a working site on the internet.

From PHP/FI to a real language

The turning point came in 1997, when two developers, Andi Gutmans and Zeev Suraski, decided PHP/FI was not robust enough for the e-commerce work they wanted to do. Rather than abandon it, they rewrote the core from scratch. That rewrite became PHP 3, released in 1998, and it is where PHP became a genuine programming language rather than a set of tools.[1]

They also renamed it. PHP now officially stands for PHP: Hypertext Preprocessor, one of software's better-known recursive acronyms. Gutmans and Suraski went on to build the Zend Engine, the core that powered PHP 4 in 2000. The name Zend is a blend of their first names. PHP 5, in 2004, was the other quiet milestone most retrospectives skip. It shipped a rebuilt object model on the Zend Engine II and finally gave PHP real object-oriented programming, which is what turned it from a scripting convenience into something teams could build large applications in.[2][8]

Why it spread so fast

PHP's growth had little to do with language design and everything to do with how it fit the web of its era. You could write PHP directly inside an HTML file, dropping dynamic logic into a page wherever you needed it.[9]

<ul>
<?php foreach ($users as $user): ?>
  <li><?= htmlspecialchars($user['name']) ?></li>
<?php endforeach; ?>
</ul>

That model matched exactly how people thought about building pages, and every cheap shared host supported PHP and a database out of the box. A beginner could upload a file over FTP and have a working dynamic site in minutes, with no build step and no server to configure. There is a deeper technical reason it stayed easy, and it has a name worth knowing: the shared-nothing architecture. Each web request runs a script from a clean slate and discards everything when it finishes, so nothing carries over between requests. That sounds wasteful, and it is the single biggest reason PHP is so forgiving. A memory leak lasts one request. Scaling out means adding more machines that share nothing, with no tricky coordination. A generation of self-taught developers got onto the web through PHP because it was almost impossible to break in a way that stayed broken.

The reputation problem

PHP earned real criticism, and it is worth being honest about it. Because the language grew by accretion, its standard library is famously inconsistent. Function names and argument orders follow no single rule, a side effect of many people adding many functions over many years with no central plan. Early versions also made it easy to write insecure code, and a great deal of insecure code was written. For years, saying you worked in PHP invited a certain look from engineers who used more carefully designed languages. Some of that was fair. Some of it ignored that PHP was quietly running an enormous share of the actual web while the critics debated.

The threat that forced it to grow up

The most interesting chapter in PHP's history is the one the old jokes miss, and it came from Facebook. Facebook was built on PHP and had grown into one of the largest PHP codebases on earth, large enough that the language's speed was a serious cost. So Facebook built its own faster runtime, the HipHop Virtual Machine, and eventually its own PHP-like language called Hack on top of it.[5] This was an existential moment. If the company with the most PHP code in the world was walking away to a private runtime, the language risked fracturing.

The core team's answer was to make PHP itself dramatically faster. The project known as phpng, for PHP Next Generation, became PHP 7 in 2015, roughly doubling performance and cutting memory use.[2][10] PHP 8 followed in 2020 with a just-in-time compiler, named arguments, and attributes.[3][4] The ecosystem matured alongside the engine, with the Composer package manager bringing sane dependency management and the Laravel framework giving PHP a modern, well-designed way to build applications. Slack, which ran on PHP and later Hack, wrote publicly about why a language everyone loved to mock was the right call for shipping a real product fast.[6][7] The competitive threat did not kill PHP. It embarrassed it into becoming good.

Fit beats elegance

PHP runs WordPress, which alone powers a large portion of all websites, along with Wikipedia, much of the early web's commerce, and countless business sites and stores. It is not fashionable, and it has stopped needing to be. The lesson I take from PHP is one engineers resist because it stings: fit beats elegance far more often than we like to admit. A language that was never designed, that grew out of one person's need to count visitors to his resume, ended up serving more of the web than almost anything built with grander intentions. It got there by being available, approachable, and nearly unbreakable, and then it got genuinely fast the moment it had to, which is the only thing the old jokes ever really had on it.

Sources (10)
  1. PHP Manual: History of PHP
  2. PHP (programming language), Wikipedia
  3. PHP 8.0 release announcement
  4. PHP RFC: JIT
  5. HHVM (HipHop Virtual Machine)
  6. Slack Engineering: "Taking PHP Seriously"
  7. Slack Engineering: "Hacklang at Slack: A Better PHP"
  8. Andrew Curioso, Ronald Bradford, Patrick Galbraith, Expert PHP and MySQL (John Wiley & Sons, 2010)
  9. Richard Blum, PHP, MySQL, & JavaScript All-In-One For Dummies (John Wiley & Sons, 2025)
  10. Iltaf (Altaf) Hussain Gul, Raul Mesa Ros, Learning PHP 7 High Performance (Packt Publishing Ltd, 2016)

Recommended reading

The Origins of TypeScript: Adding a Type System to JavaScript7 min readJavaScript's flexibility is a gift on a small page and a liability in a large codebase. TypeScript was Microsoft's answer: keep the language, add a type system on top. Here is where it came from and why it won when every earlier attempt failed.The Origins of Go: Simplicity as a Feature8 min readGo was a reaction. Three veteran engineers at Google, frustrated by slow builds and growing complexity, built a language that left features out on purpose. That restraint made it the language of modern cloud infrastructure.The Origins of Java: Write Once, Run Anywhere7 min readJava was built to run on television set-top boxes. That market never arrived, but the idea underneath it, code that runs anywhere without changes, made Java the language of enterprise software and Android. Here is the story.The Origins of Ruby: A Language Designed for Programmer Happiness6 min readMost languages optimize for the machine or the problem. Ruby set out to optimize for the person writing the code. That unusual goal, plus one framework, turned it into the language behind a generation of startups.The Origins of C#: Microsoft's Answer to Java5 min readC# was born out of a lawsuit. Blocked from extending Java, Microsoft built its own modern language, had it standardized so no one could call it a cage, and spent two decades turning it into a fast, open, cross-platform tool.The Origins of SQL: The Language That Refused to Die6 min readSQL is more than fifty years old, has been declared obsolete more than once, and still runs the data layer of nearly every web application. Here is where it came from, the rival language it beat, and why nothing has managed to replace it.