On various occasions in various settings I’ve been asked for my opinion on PHP as a web development platform. It is one of the most popular choices today, yet it is also one of the most criticized by experts. I personally have not touched the language for over a decade but it was once one of my favorite tools.
I remember doing professional web development during the first Internet boom in CGI scripts written with Perl. It was quite cryptic compared to the Java I was learning in school at the time. I enjoyed the mental gymnastics that programming in Perl offered but felt a huge disconnect between the technology and the real life time and budget constraints of the business world. Apparently I wasn’t the only one feeling this because soon there were several alternatives to choose from. At that time there were arguably three choices that bubbled to the top: Java, Microsoft ASP, and PHP. Java felt like it was by rocket scientists for rocket scientists especially if you were dealing with the Enterprise Edition specs. Unless you were working on something huge and complex, it was addressing problems that the vast majority of customers didn't have. ASP was enjoyable to work with at the time but along with a medium grade learning curve you had to pay for server software and Visual Studio. That left PHP as the most accessible choice of its time. It is free to run, had a low learning curve, and was easy to read and write compared to Perl. You could get into it easily enough and get something out to your customer easily enough.
The Internet went on to revolutionize the world and the technology it was built on followed suit. Big players like IBM and Oracle supported Java more and more and a powerful Open Source community made its own contributions. A near-180 degree switch to “lightweight” Java containers and “POJOs” arrived making Java development more accessible and relevant to many. Microsoft abandoned ASP entirely and introduced its now ubiquitous .Net platform capturing many lessons learned, best practices, and incorporating some of the most modern computer science concepts such as object orientation and separation of responsibility in code. PHP took a much more evolutionary than revolutionary growth path however patching in improvements along the way rather than starting from scratch with a fresh, new perspective. This is probably the root of much of the criticism against PHP from code purists and computer scientists.
Fast forward to 2013, the more things change the more things stay the same. PHP is still one of the most accessible platforms around. It is easy to pickup, easy to implement something demonstrable, and even easy to deploy (just place your files in the right place on the server with the .php extension!). Because it is so accessible, there is a greater supply of lower cost developers and a plethora of people making PHP-based tools. And therein lies the caveat. Because it is so accessible, the likelihood of running into a poorly built project because the developers were inexperienced, weren’t very disciplined, and/or didn’t have much formal training in engineering is also high. This affects everything from how fast code maintainers can respond to a change request, to how likely an application will go down or generate costly errors, to how secure an application is from the constant threat of breach and mal-use. The types of bugs in PHP projects I’ve seen over the years compared to other platforms is truly astounding. To achieve a high level of quality in a PHP project, one must rely on the programmers’ expertise probably even more so than any other web platform. And ironically a “real” PHP programmer is about as scarce and expensive as a professional in any other technology.
Having said that, there is certainly still a place for PHP. If the project requires something “quick and dirty”, PHP is a candidate to consider. If the project is a commodity-type project (i.e. a blog or a CMS that happens to fit something already built in PHP), that may also be a good fit. If your organization already has strong, ubiquitous PHP expertise that is something to consider. And finally, if you happen to have a lot of PHP code already, it might not be justifiable to throw it all away. Facebook, the world’s largest web application, uses PHP a lot. Having spoken with their developers in the past, they have been trying to get rid of it for years but have begrudgingly invented their own workarounds instead. This article captures some of that struggle quite well.
PHP used to stand for "Personal Home Page" and if you realize that's how it started, then it all makes sense.