DEV Community

Discussion on: Why developers hate PHP

 
andreidascalu profile image
Andrei Dascalu

on k8s, you don't need another nginx beside the ingress controller. The problem is that when you need to put something in front, for PHP, it MUST know about the files that PHP needs to interpret.

With Fastify, it's best practice to put something in front that has better scaling - but it can be anything. You can put Ambassador or Haproxy or whatever. With PHP, you can't - it must be a webserver (that knows about files & document root). With an orchestrated environment (like k8s or compose, depending on practice), just using a load balancer (or ingress controller) is not enough, you will always need an extra webserver that sits with the code.

Thread Thread
 
andreidascalu profile image
Andrei Dascalu

Well, if you look for frameworks that look like Symfony .... there's only Symfony. Not sure what you mean by "like Symfony"? Full MVC? Service layered? Bloated? Tightly coupled?
What fits in PHP won't fit in other languages.

In Go you will never find something like that because the Symfony model simply doesn't work in a high performance environment built around concurrency and parallelism. Almost. You can use the minimal Symfony framework (technically configuration + router + DI) with RR (for concurrency .... with ironically is written in Go) but if you do that (eg: forget the MVC) then you definitely have counterparts. In Node that's fastify and in Go that's fiber. Well, almost, since in Go the DI bit doesn't exist as such.

Thanks for the speedtest reference. It's mostly what I'd expect, although I'm shocked that Spiral (35k) is so low in the list. Also, it's nice to see the raw power of PHP on bare-metal, that's about what you'd expect as well, but I have never imagined that you can get 356k responses with PHP/Nginx/PGSql and just 7k with Symfony/FPM/Nginx/mySQL (well .... I won't be surprised that Laravel is at 5.5k in these conditions).

Thread Thread
 
jcarlosweb profile image
Carlos Campos • Edited

It's just that we're talking about completely different things and I don't want you to confuse anyone. I think it's very good what you're saying. But I repeat again what you are talking about is a big project, not a simple one, as I have told you before, along my career I have published 100 web pages, some with more and less traffic and I have never needed to Kubernetes and direct everything to microservices, I am learning that now? Well yes, that I need it? No, right now. And it is possible that I don't even need it. Maybe if I make a web application that has 1 million visits a day, then I'll separate it into microservices and I'm sure I'll remember you. hahaha.

Currently I find Symfony incredible. There is nothing like it. In Node.js, I found something similar and it's not called Fastify, it's called tsed.io/docs/controllers.html, but of course but as I said before is that unfortunately I'm not at your level or I work in such big projects.... And I think most of them are not either. I hope and desire some day to pass for that, I wish Go had made it more modern, it is a new language and I don't like it. More similar to Typescript or PHP8 would have succeeded.

Thread Thread
 
andreidascalu profile image
Andrei Dascalu

Well, yes and no. The OP was an academic question. Why PHP gets hate. There are plenty of reasons.
Does that mean PHP is a bad tool? Not at all. It's not the best, regardless of use case, there will always be something better.
But nobody's trying to convince people to change what they use. For any given participant here it's true that whatever they use now is good enough, otherwise they would be looking for a change.
Like you say, you'd need a use case to consider a change. 80% of people are like that. Then there are people that don't need to learn under pressure and are just curious.
Kubernetes has nothing to do with high traffic. It helps but it's not the only use case. In our company we use it to keep experimentation costs down. There are a bunch of VMs in a cluster and if you are a dev all you need to do to get your app public is to describe it in a Dockerfile and push it to a repo. In a few minutes you can automagically access it through the cluster ingress. Cluster size goes up and down automatically. It's not under heavy traffic but it makes deployment a breeze, regardless of language.
But on the language subject, it also matters what you want to use. People use Typescript but that doesn't make it good. While I'm OK with PHP and will probably always use it in some capacity, I acknowledge there are better things out there. But Typescript is crap, even though it was necessary when it came out. Nowadays Reason is way superior (and was created by the React guys for React) and hopefully will get traction.
There's plenty of great things out there as long as you can get out of the bubble. Symfony has crappy performance but run it under swoole or roadrunner and you have something (look at the benchmarks you provided). Often it's not even about changing tools just about using them slightly differently.

Thread Thread
 
jcarlosweb profile image
Carlos Campos • Edited

Yes, Symfony is not king, but I love it for what I need. And yes! Swoole and Workerman is faster than Fastify and Symfony

And as I say you are right, in almost everything. But it's not my use of case, or you don't know that there are shit websites made in Wordpress with more traffic than any other microservice-oriented page(10 people programmed microservices in different languages) .

Example: css-tricks.com/

Hey, but I don't defend Wordpress, it's fucking bullshit. But as I say, it depends on the case.

Thread Thread
 
jcarlosweb profile image
Carlos Campos • Edited

Edit:

Also, thank you very much for all the information, I hope one day to work with Kubernetes and oriented microservices, and I hope never to leave aside PHP, And of course that Symfony becomes something faster comparable to Wokerman or Swoole, so that I do not have to learn more things.