r/webdev • u/pineappletinis • 26d ago
Question How warranted is the PHP hate?
I feel like there has been a lot of hate on PHP, especially after the recent blowout regarding PHP vulnerabilities that even ended up on mainstream media. I even saw absolute non-techy people bringing up PHP and talking authoritatively about how "bad" and "old" it was lol. Not to mention the AI-shills saying one should just use Claude to create one owns CMS (!!). I am also aware that most PHP hate is usually misaligned hate intended for badly managed WordPress sites. And that some people just prefer other languages or love a hatetrain.
But one thing in particular that got to me was someone who mentioned that PHP has a page with vulnerabilities listed that go back 20 years and have yet to be patched. And that if you are a dev who is in any way interested in security within one's projects, you just don't use PHP at all. It was like having only a screen-door for your house with no locks. Do other languages have similar list of unsolved vulnerabilities? What makes them inherently more secure?
I dug around to find information about other popular programming languages and frameworks and it seems like at least right now, many are being found to have vulnerabilities due to AI being used to find them. React had a critical issue about a year ago, and Python earlier this year (although they did not blow up in the press like this).
Anyway, I would like to hear from people who use PHP regularly for work, beyond WordPress and who can maybe compare it to other languages/stacks as well. Please no low-effort replies from people who last used PHP 20 years ago or just don't like it, if possible.
15
u/abednego-gomes 26d ago
Node.js ecosystem is inherently much worse than PHP because it has so many CVEs and its package system npm is a security abomination. And typically you're not going through apache or nginx to get to it, you can hit the raw node.js server direct from the web, so much easier and larger attack surface.
48
u/De_Wouter 26d ago
My first developer job was as a PHP developer 14 years ago.
The problem with PHP IMO is not the language itself (although like most languages it has its own quirks and issues). The problem was the low barrier of entry compared to something like Java, C++, etc.
Many beginners (were) in the PHP field and well they looked at each other. The codebases I've seen my first few years were pure horror. A webshop with a 10k lines index.php file, spaghetti code everywhere...
19
u/Caraes_Naur 26d ago
Not at all. PHP8 is vastly improved over PHP4, and none of the hardcore haters have ever worked in any PHP version.
WordPress is a master's thesis in how to write PHP badly. It's not defensible on any technical grounds whatsoever. If you don't believe me, read the WP core codebase like I did. The design of any of the database tables should be foretelling enough.
Ease of use has always been a double-edged sword for PHP. While it is super-easy to get started and set something up, it also makes zero effort to stop in the inexperienced from committing heinous crimes (hence, WordPress).
25
u/Dhruv_Malaviya 26d ago
Modern PHP 8.3/8.4 + Laravel is unironically one of the highest-ROI stacks on the internet , strict typing, fast execution, tiny memory footprint on a €10 VPS compared to bloated Node/serverless chains. 95% of the hate comes from people whose last memory of PHP is spaghetti WordPress plugins from 2012. Customers pay for working software and fast response times, never for your framework logo.
11
u/icanbeakingtoo 26d ago
Oop in php is way better than whatever typescript/JavaScript has going on
8
u/crixx93 26d ago edited 26d ago
Modern PHP is fine, not great, but fine. The issue is the older versions, and there're gazillions of websites written in those. That's why those vulns are so critical, up until like 2010, almost everyone developed their web sites using the language, because it was the only game in town. Currently, we are spoiled for choice when it comes to server side programming languages, and as I said at the start, modern PHP isn't bad, but because we built so much stuff with the legacy versions, those still need to be maintained... Or rather, had to. I've been supporting the same PHP 5.6 code base for the last 10 years, and because of these vulnerabilities management finally greenlit the deprecation of it. It's going to be a huge effort, but we have no choice, we have no way to patch the vulnerabilities without upgrading the language version and that would break the entire product, it's cheaper to migrate everything to NodeJS. I imagine many organization are also being forced to expend resources on this, what's scary is that a lot won't do it because they don't have the money or manpower, so a ton of sites will remain vulnerable
17
u/allen_jb 26d ago
Link?
Are these issues with PHP itself, or projects that use PHP?
Without seeing this list it's impossible to comment, but I very much doubt it's as problematic as it might sound.
There's a standard system for disclosing vulnerabilities - CVEs. It's used for everything - every language, application or library. You can search their database and find vulnerability reports for everything (that's been reported to them - which is most vulnerabilities), and includes information on how much of a problem the issue is likely to be (summarized in a scoring system) and what versions it applies to.
Bad code can be and is written in any language. PHP, and the applications written in it, like WordPress, are more visible because they're popular and most have been around a long time, so they get targeted. If you want to get some control of servers to create a bot net, the easiest way to do that is to target widely used software like WordPress (which also has a plugin ecosystem, so there's plenty of badly written plugins).
14
u/qpqpdbdbqpqp 26d ago
Been writing php for quarter of a century. Its fine.
12
u/bcons-php-Console 26d ago
TL.DR: in modern PHP, the hate is unwarranted. Maybe it's not the best option out there for someone that wants to dive into web dev, but a totally fine option if you already use it.
I've been working with PHP since 1.998, and at that time the alternatives for web backends where Perl or C (not very friendly options even for someone with some C experience). PHP was designed specifically for web dev, and it was popular among the hosting providers of that era, so I jumped on that wagon.
Of course, my first scripts where s**t. Big files with HTML and PHP mixed everywhere and code duplication everywhere. But I got things done, and with time and practice (and lots of reading and learning around) every new project got a bit better. The language itself also got better with every release and today's PHP is a completely different beast.
I think PHP's criticism was well earned. It allowed to write insecure code (hell, it even had a setting called "magic quotes" that "automagically" added backslashes to make data coming from user input "secure"). OOP was a pain until versions 5-7. Function naming was a complete chaos. All of that is true.
But good and secure code could be written if you put the effort to do it. And with every release the language got better, so I never had a strong reason to ditch it and switch to any alternatives.
Would I recommend PHP to someone that begins the web dev journey? Maybe not: Python is a strong and more general language also widely used in AI dev and has a great ecosystem, and Node is a great option if you plan to be a full-stack dev (only one language to learn for back and front).
23
u/BrewThemAll 26d ago
It's widely used, so it gets hate. Undeserved though. They handled the exploit as good as possible, few weeks back. Of course it gets some complaints because it runs a lot of bad Wordpress sites, but that's completely unrelated to the language.
It's a good language. Not that sexy because it's old and not a hip new JavaScript engine, but solid af. I made the entire backend for our webshop and warehouse in it, and it works absolutely fine.
7
u/pyeri 26d ago
It's not just about PHP. There is quite a pattern and tendency in some specific sections of this platform to absolutely hate on anything effective and useful that doesn't benefit or validate some brand. This includes things like open source, free software, free-tier stuff, GNU and Stallman things, Asimovian principles, zero entry barriers and transparency, etc.
28
u/lbunch1 26d ago
Nothing wrong with php. It still has a strong community, and laravel is fantastic. It's probably the easiest way to get an app up and running with auth and db and everything you need for a foundation. JS frameworks are just more popular with new devs, myself included.
And AI can write php just fine too.
5
u/BrightNature4682 26d ago edited 26d ago
I'm currently a developer with PHP as our main web language. It's fine. The security issues recently are real but have been sorted by any decent team. There will be similar security issues in the future for PHP and other languages I'm sure.
It is an old language and that has it's pros and cons. The pros are that it has a very well maintained code base and packages almost always work seamlessly with each other with no issues. And there is basically always a good and well maintained package already out there for what you need. You can achieve type safety with phpstan and utilise the full benefits of modern html, CSS and typescript very easily.
The biggest con is probably how slow it is but that doesn't really matter for most projects. It just doesn't scale well. If you want a very large platform with tons of traffic and data flow you would probably be better with something else.
Arguably it's one of the best tools to use today if you're a good developer. But easy to implement bad practise if not. But no the hate isn't warranted. And usually the hate comes from people who haven't actually ever worked with it.
5
u/horizon_games 26d ago
Just like it's trendy to go "lol JS let's compare a string to a number!!!" the years before that everyone made fun of PHP. And to be fair it WAS brutal to debug on like 2 decades ago. Now it's just memes and misunderstanding.
5
u/Tontonsb 26d ago
The main thing that the recent situation showed is just how big of a workhorse PHP is and how much depends on it. It also showed that PHP people take security seriously. Both the developers of the language and its users.
I mean there was Node2Shell on the same day that PHP2Shell was disclosed. But you only heard about PHP.
4
u/ConfectionForward 26d ago
I would say yes and no, at the same time. The reason it is yes is because the vulnerability was sortof handled poorly. But really No, because there is nothing inherently wrong with PHP at all. PHP is just as good of a choice as anything else, and it actually runs a TON of stuff, and THAT is why the impact was so high. Anything that is popular is or a high value target is going to be a target.
The hate should be directed towards the rollout of the fix on that vulnerability.
4
u/zlex 26d ago
PHP is tool like any other tool. It excels at database driven REST tasks, which is why it’s so popular in web development. PHP‘s request/response lifecycle is easy to reason about, easy to scale, forgiving, and cheap to deploy. PHP8 has all the bells of a modern language, mature frameworks like Laravel, and there is a huge ecosystem of packages.
Would I use it for something that required long-lived connections or high concurrency or for data science applications? No. It’s a terrible tool for that.
I don’t think modern PHP has anymore CVEs than any other popular language. Software written in PHP though is prone to having tons of them because there is a lot of low-quality garbage written in it, especially Wordpress plugins and the like.
3
u/Noch_ein_Kamel 26d ago
At the end of the day all programming languages suck ;p
0
u/FateOfNations 26d ago
PHP is PHP. It was one of my first programming languages. It has a history that has resulted in it being widely used despite being developed in somewhat of a haphazard manner. I probably wouldn’t create a new application with it (AI-assisted or otherwise), but it should be respected for what it is.
1
u/awardsurfer 26d ago edited 26d ago
In the Age of AI Human code is dead, it won’t matter in a few years. Coding languages suited to AI will be coming soon, designed for how I works and for token efficiency.
I don’t know the full details but there are stories of AI re-writing stuff in Rust to gain efficiency. So one day some large agentic network will decide to throw together its own AI coding language to tackle a large scale problem. And that’s when The Matrix will be born. 😸🎃
1
u/kemalios 26d ago
The "vulnerabilities going back 20 years, still unpatched" list is almost certainly abandoned plugins and themes, not the interpreter. Every language has a CVE feed with entries that will never get fixed because the package has no maintainer left. What gets called PHP hate is mostly abandonment hate. Nobody is patching the 2011 plugin, in any language.
-1
u/vanderaj 26d ago
The problem with PHP is that folks who don't know how to code (before AI) end up coding in PHP. And it's horrifically bad at enforcing any form of type safety, security, or anything approaching modern web development architecture or security standards. MVC? Never heard of her. OWASP Top 10? What's that?
All that changed with AI. Adding a few key skills, Claude can create excellent Laravel and Symfony apps in next to no time, and you can ask it to secure the application properly. I'd recommend watching a few enthusiastic PHP YouTubers, and finding relevant AI skills, and you should be ok.
But hand-coding PHP? Yeah, nah, please don't.
Source: I've coded a PHP forum for 20+ years. PHP was my primary language at the time until I discovered Go and fell in love. Also, one of the co-leaders of the OWASP Top 10 for 10+ years. I recently had Claude rewrite my forum from scratch in Laravel and secure it. Modern AI is a game changer for PHP devs. Please don't hand code PHP.
0
u/coyote_of_the_month 26d ago
I've never worked in PHP but I'm generally aware of the problems people have with it.
My genuine fear though is that as the language and it's ecosystem become deprecated, huge swaths of niche hobby knowledge are going to be lost forever.
There are so many forums out there, filled with so much esoteric knowledge. Someone reverse-engineered the whole-ass ECU from a 1997 Chevy Cavalier, or figured out all the undocumented remote control codes for a 20 year old Sony AV receiver. Someone started a "definitive guide" thread in 2001 about how to run Linux on a toaster oven and it's still going today, with about 2 posts a week as people get it working on the food processor or the water softener.
And it all runs on PHP.
All it takes is one admin - who hasn't logged in for 2 years - deciding it's not worth the effort to patch the latest vulnerability. He pulls the plug and that knowledge is lost forever. Sure, it's not the Library of Alexandria but it fucking sucks if you were just in the middle of upgrading your cordless drill from X11 to Wayland.
0
u/brilliantzen 25d ago
You are right that most of the noise comes from poorly maintained WordPress sites. The real issue isn't PHP itself but often legacy code or bad updates in specific frameworks.
If you want to use modern, secure CMS options outside of standard WP setups, there is an open-source alternative called Hatamoto (hatamoto.dev). It runs as a single Go binary with Postgres and uses sandboxed WebAssembly for plugins so that one broken plugin can't crash your server or read the database. Disclosure: I work on this project.
It also includes built-in visual editing, SEO tools, caching, and an AI-crawler analytics engine out of the box. It is still pre-1.0 with a smaller ecosystem than WordPress, so it might not fit if you need specific plugins or WooCommerce stores.
-11
u/Apprehensive-Fan8999 26d ago
14 year old article, still applies today… https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/
-6
u/StoneCypher 26d ago
PHP has been dead for more than a decade. The average developer salary is less than half what it is for other languages. People in PHP are generally unaware that they are the bottom rungs of the ladder, because they're so distant from the rest of the engineering org that they haven't even noticed that all they do is maintenance over the last 15 years.
It has been more than a decade since PHP has had a single fulltime developer. My hobby language is more actively supported.
You shouldn't just skip it; you should replace any product built in it.
-2
u/Gremlation 26d ago
You can get the job done with PHP but there's literally nothing at all that PHP offers that you can't get from a better language. It has also been rotting from the head down since the beginning - its creator was a sloppy cowboy coder and that mentality infected the entire ecosystem. Even if it were as good as any other language in every respect but the ecosystem, it would be the worse choice because unless you choose to write everything from scratch with zero dependencies, it's going to be extremely difficult to avoid relying upon code written by people who don't give a shit about quality.
-6
u/symbiatch 26d ago
A lot of it is trendy and unwarranted, but it really isn’t great. Like look at the changelogs from version 3 onwards. Constant issues, lots of bugs, and so on.
They still don’t handle Unicode strings natively and there’s many other issues. Suddenly in 8.5 they randomly can make some things run 20% faster? At some point people made Phalanger that ran PHP on .NET and it was so much faster.
So, it’s slow, you need lots of extra stuff to overcome issues, it mixes return types still (oh you wanted to search for a thing? Let’s return false, which is 0, which also means the first item instead of returning -1 etc), you need to tweak the runtime settings often to be able to do what you want, it’s cumbersome…
Oh, you want to check if a number as a string matches a number? Ok, “123AAARGH” is equal to 123. Of course it is. And so on.
But some people like it.
MySQL and PHP should’ve been thrown out long ago in my eyes but they have a huge mass behind them so it didn’t happen. Sure, both got a bit better, but there shouldn’t have been a time when such things existed.
26
u/[deleted] 26d ago
[removed] — view removed comment