Economically speaking, it really is. App Engine will run those languages cheaper because it's subsidizing them.
PHP hosting is more naturally cheap which is why there are so many cheap PHP hosts out there. It basically boils down to one simple principle: boot up.
With other languages, you have to boot up. You've got to startup the app, load it into RAM and sit there waiting for a connection. With PHP, you can fill up a hard drive with code and it will all run when called as long as the request volume doesn't overload the RAM.
That's the entire reason that PHP hosting is so much cheaper. RAM doesn't get used until a request comes in.
This isn't technically accurate. Most PHP setups these days load php, keep it loaded, and listen to requests. What you describe is a process by which something like apache listens, and on EACH request, loads your php script, interprets it, and they let's the php process end. First, this is a LOT slower, which is fine if you get very very few requests, but you quickly grow out of that. Second, it's not something that is limited to php. This is how most perl site worked back in the day, and you can do the same thing with ruby and python.
Last, it really is super cheap to host php, python, ruby, perl, etc sites these days. My hobby site is hosted on app engine, and it pay $0 per month. It's been running for over a year, and gets a fair amount of traffic for a hobby site. Sure, it's subsidized, but I could run the same setup, with a bit more work on my part, on a VPS for $5/month. Yes, php hosting is historically cheaper, but these days that difference is hardly relevant.
Isn't the language much bigger than the size of the parsed code? Using PHP with FPM or with mod_php, you have that language runtime sitting there unused even if there are no requests. By your logic, CGI would be the cheapest.
It would be. With PHP the language is loaded once regardless of how much code is going to be parsed and executed. The amount loaded matches size of the code base with other languages that have to boot up, which puts a cap on how much low traffic code you can put on a single server.
PHP hosting is more naturally cheap which is why there are so many cheap PHP hosts out there. It basically boils down to one simple principle: boot up.
With other languages, you have to boot up. You've got to startup the app, load it into RAM and sit there waiting for a connection. With PHP, you can fill up a hard drive with code and it will all run when called as long as the request volume doesn't overload the RAM.
That's the entire reason that PHP hosting is so much cheaper. RAM doesn't get used until a request comes in.