Today I was forwarded a link to an article suggesting that PHP became popular "because of its merits". Furthermore, the article goes on to suggest that PHP became widely used because of its "features" and "power". I'm not so sure that's actually the case.
I think PHP's popularity arose from it having few barriers to entry, and because there were few viable alternatives. But before we can consider this, we have to look back to when PHP started to become popular. This would have been during the late 1990s and early 2000s. At that point in time, commercial Web hosting providers had limited options for hosting a large number of Web sites on low-cost Web servers. Unlike today, VMware's offerings were in their infancy. Alternatives like Xen and OpenVZ weren't yet around. So VPS-like offerings were very rare, especially at a price that a student or hobbyist could afford.
Most users of affordable shared hosting weren't able to have much control over their servers. The hosting company would often not give any sort of shell access, but rather just use Linux and Apache vhosts, and allow their users to upload their files via FTP or a Web interface. Some of the better hosts allowed for users to deploy CGI scripts. In practice, there were often severe limitations, however. The choice of language for these CGI scripts was typically between shell scripts or Perl scripts.
So to develop an interactive Web site, many people ended up learning Perl, as it was their only viable option. Perl is a powerful language, but it does have a higher barrier of entry than PHP, especially in terms of its syntax. People unwilling or unable to work with Perl had to choose an alternative. In most cases, this ended up being PHP. Ruby on Rails did not yet exist. ASP was basically limited to servers running Windows, which many shared hosting providers did not use. Java-based Web solutions were too resource-intensive for what shared hosting providers could offer each user.
PHP was free, open source, ran on Linux, and could integrate well with Apache. Thus when users specifically requested it, many shared hosting providers were willing to install it. For many users, it proved to be an easier and more enjoyable language to use than Perl. Many hobbyists, and especially students, became familiar with it. They'd develop interactive Web sites that they could then affordably host with one of the numerous shared hosting providers who did support PHP. Soon enough, some of these sites were converted to more general PHP apps, some released commercially and many released as open source software.
At this point, we not only had developers using PHP, but non-developers who still wanted to have a Web site started using pre-developed software written in PHP, as well. This is when its popularity really started to take off. But we need to keep in mind that it wasn't because PHP was technically superior or even comparable to Perl, or the other available Web-oriented languages. In many ways it wasn't, and usually still isn't.
It was essentially the only option, besides Perl, available to those who wanted to put up an interactive Web site with minimal cost and effort. Even if you didn't want to use PHP, if Perl's offerings weren't suitable or not usable with your host, you fell back on PHP. A side effect of this is that many younger developers took the language from the student/amateur/hobbyist world to the professional software development world as they progressed in their careers. We started to see larger and more popular sites be implemented using PHP, even when other languages and platforms were available.
When considering it from a technical perspective, it's clear that PHP is often very lacking. The language itself isn't remarkable in any way. Compared to many other programming languages, the language itself it is immature and sloppy. It offers a large library, but it is a inconsistent mess relative to what Perl, Python, Ruby and Java offer. Security-wise, PHP has long been known as pathetic. Looking at the changelog for PHP 5, we see a huge number of security-related fixes, even as late as the 5.2.7 release, which came nearly two years after 5.2.0, and over five years after 5.0.0 Beta 1. In terms of performance, PHP has never been known as a winner, often indicated by the necessity of a PHP accelerator for even low-traffic sites. Finally, in terms of maintainability, PHP code is often a terrible mess, often because it was written extremely quickly and with little care.
We can't deny that PHP is popular. It obviously is very widely used, by big and small players alike. But this popularity arose not because of technical merit, but rather because it was the only option available at the time, leaving people with little or no other choice in the matter. Times have changed. That's why alternative programming languages and Web frameworks have become widely used. People realize that they now have options, and thus make use of them. I know many Web developers who are extremely happy to be able to move away from PHP. If PHP truly did offer significant technical benefits, we wouldn't see the eagerness we currently see towards Ruby- and Python-based Web solutions, as PHP would be more than sufficient for most.
Like many technologies, PHP's rise to fame was more accidental than earned by merit. It was in the right place at the right time. And so we shouldn't consider it bad to criticize PHP when such criticism is due. It has served many people well, but that still doesn't mean that it isn't lacking in many, many, many respects.