page updated on July 18, 2015
This isn't a theoretical analysis from a research language perspective; plenty of languages in wide use avoid formal methods, fail to expose a core formalism, or even avoid basic type safety and inference from the 1970s. Indeed, one of the most popular languages still in wide use is the C programming language, which hails from the late 1960s. (Despite updates in recent decades, it's still essentially the same language as it was in its initial form.)
PHP's initial design goal was to make it easy to generate web pages. At its heart, it's a templating language. Take a web page. Add a couple of loops and conditionals. Add some variables. You have PHP. Take all of that away, and you still have PHP.
This means that every web page ever written is a valid PHP document. It's a valid PHP template. Whoever runs your web server can configure that server to serve that page with PHP and it will work perfectly. As well, the Apache httpd web server soon gained an extension called mod_php which added support for PHP. When Apache httpd was the most popular web server on the planet, any server could enable PHP trivially.
PHP wasn't always the obvious heavyweight winner in server-side web programming. System administrators had to enable PHP themselves. It made sense to do that, though. PHP's execution model—the way PHP turns a web page with PHP commands into a web page—is very simple. Every request has its own memory. It gets initialized, the page gets served, and then that memory gets flushed. Absent any bugs in PHP itself, you can have a thousand distinct websites running on a single server, each with PHP, and none of them will know anything about the others.
Yes, PHP running through mod_php was more efficient than server-side programs running in the CGI execution model. If you were running a hundred different websites on a single host and any one of them had any popularity, the overhead of CGI could overwhelm the web server.
Installing mod_php was cheap and easy and teaching users how to modify an existing HTML page to use a few PHP directives was much easier than explaining how to set up a CGI script in Perl or shell or C, including setting permissions and moving things into the right file and adding necessary libraries, so there was little friction for web servers to use mod_php.
If you paid $4 a month for someone else to host your website, chances are they had PHP available. If you installed your own Linux distribution, chances are the Apache httpd installation it had in the default configuration included mod_php.
PHP succeeded because, at first, it was really easy to get there. It really really succeeded because it was already there. Do not underestimate the value of being there. Yes, it was relatively easy to get started—easier than Perl or shell or C, because any existing HTML page is a valid PHP document—but more important, it was already there. People learned it because it was already there, and people installed it because people had learned it and wanted it.
Employers want to hire PHP programmers because the technology is pervasive (so there's little risk in going with the standard technology) and because there are so many PHP programmers to hire (making them cheap and easy to replace). Programmers want to learn PHP because it's easy to learn and there are a lot of jobs available. Of course, this situation was ripe to become a lemon market of programming language adoption—so it did.
When the web first started, it didn't even have images. It had links between pages and that was just about it. This was a huge advantage over what previously existed.
Then came forms and server-side programming. You could interact with these documents. You could enter your email address and get email from websites. You could add the current date into a page or the total count of everyone who'd ever read it. The possibilities were endless.
Then came Java applets, which were little pieces of code your web browser would download from the server and run on your own computer. This was supposed to be a fast and easy way to do things without waiting on the slow Internet. Unfortunately, Java applets were prone to crashing and using lots of memory and not running fast.
This means two things.
Programmers love consistency so much that they'll go out of their minds with the time and effort and resources required to make multiple seeming inconsistencies more consistent. It's like looking at a pair of knotted shoelaces and spending the entire afternoon untying them. Sure, it's satisfying to your aesthetic sensibilities, but what have you accomplished for it?
Both languages succeeded because they're everywhere and both languages continue to be everywhere because they are everywhere.
The lesson to take from this might be very simple inasmuch as it is exceedingly difficult to achieve. Find a dominant platform which is still growing. Attach yourself as an essential part of that platform. Continue to be essential.