A very pragmatic reason exists: deployment is dead simple for users with very little technical skill. Deploying PHP software is as easy as subscribing to a shared web host (expensive or not, but most will make your life easy), connecting using FTP/SFTP, and extracting a ZIP file into the main directory. Some hosts even skip the last couple of steps and let you apply a template with a well-known PHP CMS to get you started. Hey presto, you have a functioning web shop, business website, charity home page, or whatever other thing you want. There's a (PHP) app for that.
In comparison, other programming languages are hard to figure out. Python, Ruby, Java etc all need some kind of a package manager to install dependencies (PHP apps are self-contained) and need to have the correct runtime version installed (PHP just needs to be in the general neighborhood of what's required, since most broadly used packages seem to be written in a backwards compatible fashion). This is scary and unfamiliar, and highly technical. If you're deploying on a VPS (because rarely anyone has managed Python/Ruby/Java hosting services), you've now also become the sysadmin with full responsibility for the box, including patching and downtime. Compared with shared PHP hosting, it's bonkers.
I'm a PHP fan, but I think the following needs clarification
> package manager to install dependencies (PHP apps are self-contained)
PHP has Composer, which is one of the best things to happen to the ecosystem. Chances are, the piece of software you install will manage its dependencies in this way, and I'd be reluctant to install it if it didn't, as you wouldn't be able to update the software easily.
When you start on a minimal server installation setting up LAMP to the point that wordpress doesn't complain is just as much work as setting up RVM/Node and Passenger to run whatever language you want.
This is not accurate. While some shared hosts offer node or rails you will be limited by memory and it might not even run your app. The reason PHP is so good for shared hosting is that it runs per request and when you have rarely visited PHP application it requires basically no resources. You can have 100s of small websites sharing resources that get few visitors a day on single server and it will be fine. Try doing that with node or rails which are application servers that need to run all the time.
Heroku is fine but imagine you are agency managing 50 small sites. Heroku is like 7usd month minimum? You can pay 350usd month for Heroku or put it all on 20usd VPS and result will be same.
That's why all self-hosted CMSes worth something are in PHP world and there are very few in python/rails/node.
Also its not like PHP devs have been living under a rock for 20 years and don't want nice things. Git deployment is offered even by many shared hostings, people use SFTP+rsync, or things like https://deployer.org/. And there is very active market of server management tools like https://forge.laravel.com/https://ploi.io/https://moss.sh/ that combined with attributes of PHP will give you your own little super easy heroku.
And scaling... well most people don't need scale, you scale CMSes by caching anyway. And you can run pretty big scale just on one machine. And if you want automatic extreme scaling it's not like you can't do that with PHP https://vapor.laravel.com/
However the way rails apps works with phusion passenger is exactly what you are explaining. I can run hundreds of apps next to each other on a tiny VM. Once a app is loaded I don't have to rebuild the state on each request, if it is not needed anymore (or rather another app needs the resources more) it gets unloaded again.
Setting up passenger, nginx and git for pushing is also a job of 10 minutes max.
I get there is a market for PHP, I too recommend wordpress when I don't want to code something for someone. I just don't see it's 'simplicity' as argument.
You must have not worked with small non-profits with zero technical expertise and zero budget for hiring a consultant/permanent paid staff. Heroku is overcomplicated, and Docker/static sites (or the command line/running a server of any kind) might as well be alien technology. Some orgs know just that little.
I don't see how PHP fits into your example either.
Who is writing the code in the first place? They're uploading existing code to a shared host through FTP but then who wrote the code? Is it a prepackaged Wordpress? But then Wordpess hosts already exist.
If the developer is giving them a zip to upload, why can't the developer handle the deployment as well?
You moved the goalposts so far that the example doesn't make any sense anymore.
> Hey presto, you have a functioning web shop, business website, charity home page, or whatever other thing you want.
If we're talking about simple templates to open a store or a simple landing page there are so many no-code options like Wix/Shopify/SquareSpace/Square that I don't think PHP offers any significant advantage.
It's not that hard to get deplatformed, but yes, I can see your point. From an operational ease of use perspective they are strictly better than PHP, at the expense of trusting the providers to do the right thing.
In comparison, other programming languages are hard to figure out. Python, Ruby, Java etc all need some kind of a package manager to install dependencies (PHP apps are self-contained) and need to have the correct runtime version installed (PHP just needs to be in the general neighborhood of what's required, since most broadly used packages seem to be written in a backwards compatible fashion). This is scary and unfamiliar, and highly technical. If you're deploying on a VPS (because rarely anyone has managed Python/Ruby/Java hosting services), you've now also become the sysadmin with full responsibility for the box, including patching and downtime. Compared with shared PHP hosting, it's bonkers.