7 ms·
Serious question, more out of curiosity on the state of PHP in 2021. Because of the advent of such things as Python (which I see a lot of comments in this threa
by BLO716 5y ago
Serious question, more out of curiosity on the state of PHP in 2021. Because of the advent of such things as Python (which I see a lot of comments in this thread about) - is it still relevant as a tool? I use it for minor projects internally to prop up a website on a Pi here and there, for ease of use - but curious what the state of the language is.
Anyone have stats on this?
- mgkimsal 5y agoAre you asking "is PHP still relevant as a tool?". (the 'it' was slightly ambiguous to me. PHP is absolutely relevant, I'd think, by many peoples' measurements. But... we're on a 'hacker' site and people love to dump on PHP. PHP powers a large portion of internet sites. One estimate from w3techs is ~80% of sites with a known server side language are PHP. Yes, much is WordPress. If you estimate that half of that is Wordpress, that still would leave... ~35%-40% of sites using PHP. Maybe even that is too high. What if it's 30%? That's a large number, both in terms of percent and absolute numbers. Yes, PHP is 'relevant'. The ecosystems (Symfony, Laravel, etc) are pragmatically iterating, evolving goods ideas from a wide spectrum of web platforms. The language itself is similarly pragmatic, adopting new features, deprecating legacy stuff, and moving forward. The language is roughly 3x faster than it was 10 years ago, while retaining a lot of backwards compatibility. The language itself along with various frameworks offers a good combination of speed of development, flexibility and rigor. The 'shared nothing' default makes it easier to reason about for many problems. Need to write a small shell script? Easy in PHP. Need to scale up to large loads? PHP can do it. There will be scaling concerns in any large setup - a PHP platform will likely have similar problems that other language/stacks will encounter at similar load. So again, yes, it's relevant. There will be some other response saying "no", and then ... we'd have to define what you mean by 'relevant'... :) Popular? Growing? Evolving? Uptick in usage for many problem spaces? Easy to scale? I'd say 'yes' to all of those.
- mkr-hn 5y agoOn WordPress: it's important to remember it's a starting point for most of those uses. It's what people build entire platforms on when they don't want to/can't afford to start from scratch. People sometimes dismiss the number because "it's all WordPress," but that would be like dismissing Rails or Django. WP isn't exactly like Rails/Django, but it fills the same niche where you can pretty much assemble anything you can think of from pre-made components.
- tmh88j 5y ago>WP isn't exactly like Rails/Django, but it fills the same niche where you can pretty much assemble anything you can think of from pre-made components. Headless WP is becoming very popular too, and it seems to fill the same role. I've never used it, but I would imagine it takes just as much knowledge to build an SPA as any other backend framework like Laravel or Rails. https://wpengine.com/headless-cms-research/ https://wpengine.com/headless-cms-research/
- javchz 5y agoA lot of people talk about serverless hosting like a new paradigm. But I will say the success of php was the huge amount of hosting providers where you send the files trough FTP, linked a domain and that's it, it's working. No Linux terminal knowledge need it or worry about Nginx, SQL, or iptables configuration. Yeah most of those cpanels hostings are bad for scale, but for a lot of new devs allowed them to deploy without having to be a sysadmin
- smaps 5y agoWithout those cpanel hosts I wouldn't be a web developer today. It was so easy for me to start messing around and teaching myself to code using them.
- Shish2k 5y agoIt still has by far the lowest barrier to entry for basic deployments (pick any random cheapo shared web host; FTP your files to it; done) - that counts for a lot in the real world, and I’m sad that nobody else is even trying to compete :(
- ehnto 5y agoI'm surprised too. Every other language ecosystem seems to be competing for the Most Enterprise Tooling Chain award. Can you deploy it without an AWS expert? Not enterprise enough!
- slim 5y agoIt seems to me that all that "serverless" stuff iscompetition
- withinboredom 5y agoYeah, I’d love to see some serverless php support since the language is made for that paradigm.
- BafS 5y agoYou should have a look to Bref (https://bref.sh/ https://bref.sh/)
- sroussey 5y agoI think AWS lambda supports php
- withinboredom 5y agoThere’s Bref for the Serverless framework but it only supports AWS and they have no desire to support any other frameworks.
- tomschlick 5y agoThats exactly what Laravel Vapor does on top of AWS Lambda: https://vapor.laravel.com/ https://vapor.laravel.com/
- aklemm 5y agoIt runs (most?) of the Web considering WordPress usage, but more interesting is the moderns ecosystem with excellent projects like Laravel.
- greenshackle2 5y agoMost of the web by traffic or number of websites?
- jensensbutton 5y agoLargely both I'd imagine. Facebook, Slack, and Etsy all still run PHP (or Hack which is a PHP flavor) as far as I know. I'm sure there are a ton of other large web properties doing the same for their web tier.
- kyriakos 5y agoAll of the main adult industry properties run on php and that's a lot of traffic.
- muglug 5y agoHack is not a PHP flavour. It's a separate language that's inspired by PHP, with its own separate interpreter (HHVM). Etsy still uses PHP, as does Vimeo and Wikimedia. A few other launched-in-early-oughts web properties rely heavily on it too (e.g. Flickr).
- ehnto 5y agoPHP has evolved leaps and bounds as a language, and as a community and ecosystem. It's still ubiquitous too. There seems to be an entirely theoretical delineation between "serious work" and PHP applications, but it doesn't exist in reality. I still find it has one of the best developer experiences for web applications, out of all the tools I've had to learn through agency work.
- 1123581321 5y agoThe language still has plenty of footguns but most serious development is done through well-organized application frameworks and CMS starters. Performance is fine and can be parallelized as well as any application server language. There is a lot of documentation and community support for good proxy and server config, and plenty of hardened images or container configs, so the days of relying on pokey Apache on shared hosting are over for anyone who cares.
- dec0dedab0de 5y agoAs others have mentioned, WordPress is still huge. I believe Facebook is still mostly php, and I'm sure there are tons of sites started 2005-2010 that are still php. PHP is easy to deploy, atleast from the start, but was difficult to use compared to python and ruby. It's deployment model also encouraged people to edit directly on the server, which lead to all kinds of problems. So it got a bad reputation. I have heard that it has fixed many of it's inconsistencies, but many have already moved on. The ones still using it are either stuck, or happily quiet.
- mkr-hn 5y agoI assume the addition of a local testing server to bring it up to speed with other languages improved things.
- rabuse 5y agoThis may get me hung on HN for saying, but I honestly love working with PHP.
- mszcz 5y agoSeconded. My brother got into frontend dev (JS mainly) so sometimes I probe him for what's being used. Each time I do this there's a new thing. And the JS tooling? my fucking god, how I despise it. The opaqueness of it all, the mountains of boilerplate code and files I need to download to do things "by the book". Whenever I dip my toes there I always long for the simplicity of my backend PHP setup and almost always try to ditch what's cool and new and do things as vanilla as possible. Or maybe I'm just getting fucking old & grumpy ;)
- mikojan 5y agoI've been writing personal frontend projects mostly in vanilla JS for over a year now. "Mostly vanilla JS", because I occasionally pull in a routing library (you'd probably do the same in PHP). Modern JS (modules, web components, fetch, ...) is rather expressive and powerful, and you absolutely do not need to pull in a framework and twelve third-party hype technologies to get a small project up and running.
- Darmody 5y agoFramework X Yoyo Revolt Swoole Only to mention a few of the newest and hottest PHP tools. Then you have all the heavyweight, widely tested and used like Symfony, the Laravel ecosystem, Yii Framework, etc. PHP has never been better and healthier.
- tored 5y agoDefinitely. I write PHP at work, everything from 10 year plus legacy cruft to brand new projects, and it still works well. I'm not a Python developer, but it is probably true that Python is a better designed language and has more bells and whistles as language, like decorators, operator overloading and modules. Python is also used in more domains than PHP. But if you look past some of the weird design choices, bad reputation and the packaging as web only language, you will find a JIT-ed & typed dynamic language with good performance, FFI for easy C glue, good threading performance that is not suffering from a GIL like Python, a large & mature standard library, can be used everywhere from a small script to a large monolith, a true diamond in the rough. Today I worked on a importing system that takes an HTTP stream to read a CSV file line by line to mangle it and rewrite it simultaneously to a FTP stream, never keeping the entire file in memory nor downloading it entirely to disk first, and by only using functions from the standard library. I'm not saying you can't do this with Python, you probably can, or any other language, I just want to dismiss the idea that PHP is only suited for typical web tasks, PHP is a versatile tool that has every potential to expand outside of its traditional role.
- mszcz 5y agoWhat I miss the most in PHP is support for threading. Krakjoe did wonderful, unappreciated work with pthreads (the PHP extension). Sadly, that's no longer maintained.
- mayli 5y agoCorrect, even pypy provides the JIT, but it's missing in CPython. The performance is almost always the pain point of python, when compared to any web languages except ruby.