I’ve noticed online a lot of times when someone asks a question about php or if they should learn php it’s always met with no or why would you learn that, I’m curious why that is.
I’ve noticed online a lot of times when someone asks a question about php or if they should learn php it’s always met with no or why would you learn that, I’m curious why that is.
For further actions, you may consider blocking this person and/or reporting abuse
I've got 17 years of PHP under the belt and there are some points to be said:
The "needs a third party server" isn't a negative. If theres one bitter lesson to be derived from the rise and fall of Nodejs as a backend webserver, its that servers written in scripting languages will never compete with those written in performant languages like C, Rust or Go. Theres a damn good reason why the rails or django people usually put their stuff behind something like Nginx or Apache. Like yeah, most of these things have native webservers if you want them. But you shouldn't, and nobody with any experience does.
I'm not defending PHP as a language, its atrocious, but it'll flatten any of the JS frameworks for scaleability and performance simply by virtue of the fact it doesn't even try to be a web server.
there's a big different between nodejs's implementation and php. Namely that in a cloud native environment, you can let the ingress controller (effectively nginx or similar) to perform the same task. It will perform the same as on a local machine with an nginx in front of it, since it never needs more than your regular reverse proxy.
FPM doesn't work with that. It needs its own dedicated nginx/apache and doesn't work with pure reverse proxies or load balancer (which are not themselves aware of physically present files).
In this context, while PHP/FPM/Nginx can theoretically scale better on a bare metal environment, it doesn't do as well in a cloud-native environment.
Well, now days you can use openlitespeed with its mod_php, a better alternative to php-fpm and nginx or apache mod_php. :-) Also you can use swoole :-) To make it multithreaded and run as a server on its own. As well there are other implementations. As well you can write your own requests handler and run it, for example, like in laravel
php artisan serve
. There are many solutions, just need to investigate. But yeah something that is implemented to work out of the box for production, yes it doesn't exist. That's why we have web servers. :DWell, the question was why php gets a bad rep. Think about what you just said. Roadrunner aside, you need to go to third party tools just to get things running.
Nobody ever said there's no way, I also listed some, you did and so on. But there's a lot of legacy out there, lots of inconsistencies in the language and despite all the new stuff that's nice and all, you also need to be in a position to use it.
For server:
Your argument with versions can apply for ALL languages out there. There will ALWAYS be apps that run with code from 10 or 20 years ago. In my experience, the salary for those (boring) jobs taking care of old apps can be way better due to the limited number of capable resources.
Well, yeah, but it's only with PHP that you see so much legacy still in production. The only other language with the same weight is Java. It's no to say, for example, that you can't find applications in that are legacy and running, but the special case of PHP is that literally ALL CMS in PHP have their bulk of code written legacy-style. And then people use them to start new applications today and the developers working on them won't be exposed to good practices.
There are modern cms out there, problem is that they don't have enough usage, plugins, and integrations to beat WordPress. That and the fact is that most WordPress users do not care about what's under the hood.
It's kinda unfair to blame the incompetence of the CMS on the language itself though. I think PHP has longer history than some languages and thus have more apps with legacy code. When you have millions of business depend on you, you cannot make radical decision to break things left and right.
exactly, so you have an environment the promotes legacy and bad practices. Also, while Wordpress "users" don't care what's under the hood (users or customers never do), Wordpress developers (as in developers customising WP for use cases) also don't (not really). But they have contact in the sense that sooner or later you use hooks, you need to debug - and the code that you see models the code you write. And then the code you write then becomes part of your style. And then, at some point, you come into contact with people who write modern code and .... that builds the reputation of the language.
Right, I do agree. I have another perspective though, perhaps unique to my situation: when a client contacts you and asks you to do something related to .net or java, they know they must pay big bucks. On the other hand, clients for PHP work normally have a much lower budget, they always look for quick, and cheap gigs. That comes back to bite them in the future though because you cannot have great developers putting a huge amount of care into the project. You end up with quick hacks that are full of holes.
Also despite all it's faults, I find it very difficult to convince a client to try out any other solution. Even knowing all its shortcomings, the clients always want to use something that is popular or recommended by their marketing guy, or that they are familiar with.
I'm not blaming anyone for this of course (perhaps it's everyone's fault?). It's just an observation.
I suspect there's multiple reasons.
First, I believe those haters never tried anything like PHP 5 and come from the preceding era. Honestly, versions since 5.3 are decent.
True, there is much legacy in PHP and quirks here and there. But man, jus look at JS. It's a ridiculous mess, and how popular it is nowdays!
PHP is becoming more awesome every year with every new release.
Second, I think there are many devs that started with PHP, and we know how shitty our code was in the beginning. (Those who do not yet recognise this, no worries, just wait a couple of years and then look back.) And since php is very flexible, it allows for pretty bad design errors. So I think there is a lot of bad code there written in PHP, that gets attention. People who see that will generalize and blame PHP, but it's not the language's problem.
And the worst problem of all is that PHP allows for the shitty code to actually work.
Hey Korey, I have noticed that, too. A few months ago before I got to know PHP. I am self-taught in HTML, CSS and JS for only about a year...so can't really judge.
My only guess is, that PHP is pretty old and paved the way for dynamic websites earlier as a server-side scripting language. But with modern webdevelopment and the rise of frontend frameworks, scripting is done more on the client-side with JS. Plus, JS move to backend server-side with node.
Here in Germany there are many job offers requiring skills in PHP since many apps still rely on it, so there's no hate at all!
I think those views are largely based on the old-fashioned PHP of a decade ago, which was a "hackish" cobbled-together scripting language with an inconsistent API, no proper module system, and so on.
Modern PHP (version 7, and soon 8) is lightyears beyond your granddad's PHP in terms of performance, modularity, features (OOP) and so on.
Couple that with a framework like Laravel (as opposed to the spaghetti code of Wordpress) and you have an absolutely powerful and elegant development environment which can (even in this era) compete with the likes of Ruby on Rails, Python/Django or Node/Express.
Anyone who thinks PHP is dead and old-fashioned, think again, it's alive and kicking, and it's used a LOT.
Hi Korey, I love PHP, on the contrary. For your info, it's a backend language, that can be embed with your HTML code.
May be some hate just because of the word of mouth effect. When I first started programming, I also met with that PHP haters. But ironically, I got blessed, also thanks to PHP. Many people still use PHP. If not, there wouldn't be PHP 8.
P.S. I create an e-book about 50 useful tips when using PHP. May be you get benefits from this? gumroad.com/l/50phpcode/blackfriday
The accumulated legacy from PHP 4.x is where most of the hatred comes from, even though it's no longer supported, nor is its successor 5.x. PHP definitely has gotten flak for quirks, but there has been huge improvement since 7.x at cleaning the worst of them... exception handling comes to mind as needing and getting more love in v7. Plus, PHP still has plenty of applications using it... WordPress is often used as an example, but don't overlook MediaWiki, the foundation behind Wikipedia and many other topic focused wikis.
Developers in general are strange human creatures. People often users terms such as nerds to describe us for a reason. We are usually over-passionate about certain things (hate or love), and are often closed-mind (surprisingly). Once we hate something, we never look back.
PHP was an easy blame target for many security and performance issues of the web, mainly because it is:
I think one should learn PHP if:
Its a cultural thing really. Working on PHP tends to mean your working on Wordpress. And wordpress is a lousy piece of ancient software. Theres no joy in that stuff, its the burger flipper job of the codemonkey industry.
To make it worse, wordpress's evolution traded one set of bad ideas (Old PHP, barely structured, no separation of concerns, etc) with a horribly convoluted Java inspired hell. Even 'simple' frameworks like Laravel inevitably end up forcing you to buy into Symphony (if anything just to swap out the horribly written ORM for something a bit more capable like doctrine) and from there things get bureacratic and painful. Its just not a fun way to live.
Unfortunately JS isn't much better. Its fad driven, prone to abandonment and incapable of learning from past mistakes and lots and lots of abandoned libraries , but outside of js, trusty old Rails still works fine, Django is marvelous and on the ascendent (which is sort of amusing to see it reach fad popularity , as pythons actually a pretty old language), Java sucks, but its still a solid choice if you need access to some extremely complete enterprise libraries, and Go and Rust are both proving themselves as excellent choices for the speed demons out there.