I think, the trick is to not over think it. Just go with your first impulse. Be quick, be lazy, because most people are and when you reply like most people, you are “no robot”.
On the server-side PHP is used by 76.8% of all websites (a large chunk of that being WordPress). It is not going anywhere, soon. Looking at this statistics, nothing else seems to be even in the same league from a pure usage point of view.
I have yet to see a reason why it should change. Serious question: What is the disadvantage of using the tried and tested PHP8 compared to the alternatives, if you already know PHP?
Poor performance, execution model limitations, lack of static typing (although they seem to be working on that), and general legacy cruft.
Don’t compare PHP to Node, Ruby or Python, they also have problems. I think Go is currently the best choice for a web backend; an objective evaluation of PHP and Go would certainly put Go ahead. If you know PHP, you can pick up Go in a day or two, so I don’t think that’s a great reason to keep using PHP either.
Usage statistics are a highly misleading, software projects take several years to develop and a majority will fail. Looking at current usage tells you the most popular choice from 5 years ago, not today. Over 90% of video games published in the last 5-10 years use Unity or UE4, but these probably aren’t the best choices today.
I think Go is currently the best choice for a web backend; an objective evaluation of PHP and Go would certainly put Go ahead. If
Yes for performance running code, for performance as in “developer time” PHP is way faster. Go is solid but developer take more time implementing stuff with it. Use PHP for everything business related except for that one or two cases where you really need the performance that Go provides and where it is worth the extra dev time.
Serious Answer: PHP in itself is not that bad, despite some discussable decisions in function naming and arguments order to name a few. The biggest problem, is that it has a settings file describing how it works (php.ini) and that sh*t will bite you in the rear when you move apps from server to server, where all the libs are different etc… PHP never works out of the box when moving something on a new server, that is the worst part of the language.
Maybe the issue in your example isn’t related to “how bad PHP is” but is to “how bad the code you’re referring to is”. Never had those kind of issues and yes obviously you’ve to know what extensions an application is using, but once again, modern PHP applications usually use composer as dependency manager and will gave those specified inside the project.
Good on you to not have to maintain legacy code (15years+). Also, as a comparison, with JAVA, I have a legacy JAVA 1.5 to maintain, as far as you have the runtime, that stuff works, and that’s it. This is how it should be.
Easy example. Have they fixed file upload behavior yet? Do they store the entire file in memory by default instead of chunking it and storing it as it comes in?
If not it’s like the worst memory usage of any language possible.
If you have to go change the php.ini to adjust file upload sizes, it’s not really moving forward and is decades behind other languages.
File upload behavior is actually determined by your web server (unless you’re launching PHP in listening mode) so apache is probably who you want to blame here.
Other languages behind reverse proxies from apache https or nginx do not have the same memory hit. You can still blame php. Not my fault they tied their language to the webserver in a way that uses tons of extra memory.
Easy example. Have they fixed file upload behavior yet? Do they store the entire file in memory by default instead of chunking it and storing it as it comes in?
Are you in 1995? PHP dynamically decides how to manage uploaded files, it will generally store a few MB on RAM and move it to disk after that point. It also support streams so the backend can take the incoming data live and do stuff with it without storing it first as usual in the classical model. There are also plenty of higher level solutions to deal with chunked uploads, mobile clients disconnecting such as tus.io that are used by large companies like Vimeo.
It’s the text ones for me. I struggle to read the font on some of them so I can’t tell the difference between a capital letter or a lowercase one so now if they’ve the text reader for blind/partially sighted people I’ll use that.
Languages don’t die. That’s a misnomer. They have long tails of diminishing use and no junior programmers entering the space. If you’re one of the experts in the language left around, you can make a shit load of money.
And the jobs are rarely worth the stress of picking apart the terribly designed, chock full BizDev rushed ads-on features due to foolish promises, and a manager that’s stressed out due to how few experts they’re are that’s going to try and micro-manage you because his skip-level is breathing down his neck about when something is going to be fixed.
I’m sure there are a lot of reasons why PHP is better than Python for the backend, but I created an app wirh Symfony 5 and then an app with Django 4.
Symfony is so weird compared to Django. With Django I can just sit down and get things done. Symfony always seems to have some quirks which are mostly due to PHP (and me not knowing how to program in PHP).
That said, PHP hosting is so much easier and cheaper, this probably is important for smaller projects.
Many older projects don’t get migrated to containerized infrastructure and smaller businesses don’t want the overhead it creates to run a single app/webpage. Plain LAMP with FTP access is still the most common way to host I think (and thus the cheapest if you consider the amount of work that would need to be invested to containerize).
The industry is surely changing, but “the industry” is mostly geared towards enterprise, because it’s where the money is. But the large amount of webpages are not enterprise pages but personal blogs, small businesses etc.
For the backend? Why? I could see PHP being better for the front end considering it’s basically a templating language already, and setting up Python on a webserver is much more complex, last I tried.
Oh, I see what you mean. I thought you meant output HTML and templating vs server side logic, but yes, obviously I know the difference as the only front-end language is JavaScript and derivatives.
I’m more used to the terms ‘server-side’ and ‘client-side’ btw. Obviously PHP is server-side. But not all server-side is backend in my view. I consider backend to be application logic and things like database access. Templating can be done on the server or the client, and that’s front-end.
Lets just say that Python was a language that was never supposed to be used for anything production related. PHP’s memory management and multi threading capabilities are WAY more solid and less prone to leaks than Python 's.
As someone that used PHP professionally for literal decades, the PHP hate is so meme-y.
Its biggest problem is that it allows you to do some truly cursed things. The same can be said about other languages, but PHP really doesn’t do much to set you up for success, especially as a new-intermediate coder.
With opcache, it became fast enough for basically most web backends, and as a language overall it does seem to be evolving and shedding off some of the crap that used to make it truly horrible in the hands of a new person. At least the type-juggling stupiderrors
Now I mainly use go and python (only because I have to on this one), and I would put Python and PHP on a similar level of “fuck this language” moments
This was nearly a decade ago. I worked at a small app company (5-10 developers) for a bit that used Ruby on Rails for our product. The product was in active development, but was available to customers so it was “done”. We were hiring a senior level dev to oversee the team and we interviewed this guy (maybe in his 40s?, a but older than most people in tech) and he said his first order of business if hired would be to refactor the entire code base to php. I don’t think he was joking. I’m not sure why he interviewed.
Since the beginning, GitHub.com has been a Ruby on Rails monolith. Today, the application is nearly two million lines of code and more than 1,000 engineers collaborate on it daily
django and flask are python btw and people wanted to learn python or perl from like 15 years ago, the popularity of python 2 and its “Issues” led to robust dev on python 3, not to mention it being a default for many linux distros since a long time ago
telegra.ph
Active