PHP is bad.

I just skimmed/read this article. It states that PHP is just as good as Rust/C/Java. That the opinion that it is bad is just 10 years out of date.

5 years

I would say even 5 years ago it was really bad. It was not secure and frameworks were lacking professionalism. To be honest I would say PHP is still bad today.

Criticisms

The criticisms to bad structure, SQL injections and general security related things are all batted away with one statement: use frameworks. Just use a framework and magically all things are fixed. That is a lie. The fundamental nature of PHP will make it be bad, no matter how many cool awesome things you build on top of it.

Also frameworks themselves are also not foolproof and still will suffer from security flaws. Aside from this there are some other problems. Just search for all the CVE's of your favourite framework. They still occur across the board.

Concurrency / parallelism

The main problem with PHP is that it is not async in any way. It does not support threads, multiprocess or other constructs to make it concurrent or scalable in that sense. It just does not utilize the CPU efficiently. This also is combated in the original article by stating just throw more servers at it. Also the database is the bottleneck in all architectures, just scale that first then you can scale the application too.

This is just nonsense. The database is hardly ever the real bottleneck. I made many applications, enterprise and non-enterprise, and I did not once run into the issue the database could not cope with the amount that was requested. Inefficient queries, sure, lots of request to the webserver, sure, but not that the database was struggling and the application was doing just fine.

The fact you should not have to throw more servers at it is what is important. I worked on a simple Java application using Spring Boot and HATEOAS. This application is used by 100s of concurrent users. I only need to run one instance of this application to handle all of that. It is not even one giant instance with lots of resources, it has 2vCPU and 4Gb memory. That is all that is needed to support complex workflows for 100s of concurrent users. The database is a modest t3.small instance.

Code itself

Of course PHP has typehinting these days and namespacing and all good things, but it still suffers from the same problem outlined in this article subtracted with the addendum of this article. The core is trying to get better but it still is weak. I think the author of the article is referring to this ten year opinion.

The tools you get are still slightly different from normal tools. So the things that get built with them are all slightly wonky.

Deployments

To deploy PHP is horrible. Same goes for Python, because it is not a compiled language. So to make artifacts and deploy consistent code is actually quite difficult. Putting them in a container does not help as you always need a webserver to serve the PHP code. Same for Python where you need something like Gunicorn or similar to wrap around the code. Unless you wrote a server yourself.

It also just is not fun to write PHP.

#code #devops