Disclaimer: I’m definitely not the biggest fan of PHP. For the same reason why I’m not the biggest fan of Perl. I’ve been using both extensively in the past decade to build websites, but when flexibility becomes sheer lack of structure it becomes easy to build unmaitainable and un-debuggable monsters.

The pervasiveness of web frameworks based on PHP justifies part of its success, but it’s not the only reason. PHP makes it easy to deploy server-side web logic — you drop your PHP script into your web server folder, and you’re good to go. No compilation, deployment or transpiling required. That is, in my opinion, still a big win for an ugly language like PHP, a big plus that is not yet matched by any other language used for server-side web development.

Java is structured and tidy, but it makes web development a cumbersome nightmare of compile-deploy-reload iterations, and it makes even relatively simple web application needlessly verbose. JSP came later to overcome this cumbersomeness, but it almost came in as an afterthought.

Javascript has a lot of potential for web development (plus it allows you to use the same language both for server and client-side development), but its extreme lack of structure and lack of functionalities unless you piggyback on some external frameworks and libraries makes it a meta-language that still requires extra transpiling and deployment steps in order to deploy your application — plus, a gigantic and unmaintainable node_modules folder. At least PHP is kind of self-contained and you usually don’t need to add extra dependencies for developing a simple web app.

Python with Django or (even better) Flask has a lot of potential to replace PHP, but for some reason it hasn’t really won many server-side developers.

In the end, I overall dislike PHP, but I think that the reason why it is still so much around is that other server-side solutions have so far clearly FAILED in making web development an enjoyable experience. That’s why PHP is still the most used language on web servers, and the second spot still belongs to an even uglier and more unmaintainable language like ASP.NET. It’s not because of the merits of these languages, but because of the failures of other languages.

Automation, IoT, programming, machine learning, science, math, economics and more. Powered by Fabio “BlackLight” Manganiello and Sneha Divakar.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store