PHP Is Web Shell
hiandrewquinn.github.io
hiandrewquinn.github.io
I have some experience with other languages. I cannot think of any other that is "better" in the same domain. (Bash or F# are "better" but in a different domain).
Javascript has a lot of things I love, and I wish PHP would copy. But I rely on my Nginx/PHP pages more than on my Node/JS pages, and after a while I realized that PHP made better decisions, overall, for back-end.
I have a love/hate relationship with Python (I like the indents; I don't like the virtual env, etc. unpopular views) but PHP is faster, has much more ready to work without hassle, and borks far less.
Skilled PHP devs know to avoid the footguns, but that doesn't mean they aren't there.
It's in a better situation now than it was. I hope.
We can't all be elitists and chronological snobs enjoying Rust, Ruby, and Node and bragging about how this is the only good or practical way to do things.
PHP, which WordPress is built on, is on somewhere between 70%-80% of websites in total. Websites you may not expect, like Wikipedia, Facebook (with a modified dialect), Etsy, and Slack have large PHP Codebases. As well as the 11th and 15th most visited websites in the world which are almost entirely PHP but, em, NSFW [1].
COBOL is still running every major bank, right now, as well as the IRS. Visa and MasterCard are still running on their IBM Z mainframes.
Heck, not even DOS is gone. I've seen updated DOS programs running the registers at McDonalds in my area. Our midwestern regional hardware store brand (Menards) openly uses DOS programs at almost all of the employee kiosks for looking up information. Don't believe me? Here's a reddit thread about someone criticizing replacing System V at that hardware store branch (which covers MN, WI, and Iowa). https://www.reddit.com/r/menards/comments/t5czy3/system_vi/ and https://www.reddit.com/r/menards/comments/11lb6pf/there_is_a...
[1] Anyone who says PHP doesn't scale - point to, well, any porn site, as well as Wikipedia and Etsy, and you'll have proof it's completely BS.
https://www.reddit.com/r/menards/comments/rgc2ux/question_ou...
I also suggest both languages have evolved quite a bit since. Between these, though, I think modern JS has had the most impact. This can mostly be attributed to the node community, with a great deal of insights from ruby.
Things like async patterns and quality package management have changed our standards for what we expect out of modern languages, despite the coerson based parlor tricks chuckled at by those who don't use the language.
PHP, on the other hand, is still a templating language that lives and dies in a request response cycle.
But there's a different take:
I've written a lot of bash shell in my life, but at some point I quit and moved over to Python. Having a decent programming language makes building any kind of workflow so much better, easier, prettier, more readable. Anything beyond 10-20 lines becomes Python. Every single time I think 'nah, bash is good enough' I come to regret it.
I wonder if and what the equivalent analogy with PHP is.... ;-)
Edit: I think there's room for a language with modern control flow that just wraps bash. Like if (true) { cat("path") }
I beg to differ
The result is not particularly "pythonic" but I think it beats a pure bash script if there's non-trivial business logic.
The observation "PHP is web shell" does not seem very insightful or interesting.
There are a couple of other ways to make web calls in PHP that don't require curl (which I agree is a bit confusing if you're coming in cold - I've been doing it for decades and still have to look up the docs every single time).
If I need to do a basic kinda GET request you can simply call file('https://example.com') to pull in content from that URL. fopen() also supports URLs.
I do this in shell scripts (and "web shell" as the author calls it) all the time.
If the author means the logo, they should schedule an optometrist visit
But then again you use shell because it works _everywhere_ and that is not true for PHP. PHP is evolving and unless you take some really old code and throw it in a new runtime, nope. People write PHP in the 2020s decidedly different than in the 2010 or 2000s. My bash scripts from this year are working on ancient RHEL machines. And overall I'd say it's very, very hard to write well-tested easy to maintain software of a certain size in bash, whereas in that regard PHP is just another regular programming language.