I’d be interested in seeing this graph with Wordpress excluded
Programming languages that no one uses.
Programming languages that everyone hates.
I doubt more than 25% of the hours spent by programmers on software that runs on web servers is spent on PHP code.
If you look at market share by traffic, a much smaller share than 79% of the world's largest web sites (Wikipedia, YouTube, Google, Amazon, Facebook, Twitter, Reddit, Instagram, eBay, PornHub, etc.) run on PHP. Those websites account for the vast majority of Web traffic.
[a] Source: https://wordpress.com
--
EDIT: I changed "0.0%" to "a much smaller share than 79%" because I was wrong about Wikipedia, Facebook, Pornhub and likely other high-traffic websites. See comments below.
Technically though, Facebook uses Hack, a more strictly-typed customized version of PHP for their own uses, but Hack is still mostly compatible with PHP and until recently could process any PHP file directly.
Php seems to be in such a stable phase, fixing old issues, modernizing and powering real apps used everywhere. Wordpress is being mentioned, but don't forget that wikipedia / mediawiki is also php and what those folks are doing with wikidata is ground breaking.
There are plenty of scenarios in which php could grow again, e.g widespread decentralization using nextcloud, wikidata or similar.
I missed php, but I don't hate python or c#. In fact I like them both as well. Also because they're all turing complete, basically we can create anything with it.
Side note: not sure what do they mean by websites, does microservices counts? because most backends are talking to other backends these days with many other languages too
Yes there are faster, easier, and more elegant languages but PHP isn't going anywhere.
...due to WordPress, I'm guessing.
This suggests that company adoption either doesn't perfectly track with or significantly lags behind community interest (by ~10 years), which is something I think we all know is true but this is the first time I've seen it measured in a meaningful way.
So then how on earth do they arrive at the claim that only 1.5% of websites use 'static content'? I would be astounded to discover that 98.5% of sites are using a serverside rendering technology to deliver every single page on their site (let alone their CSS, javascript, images, favicons, robots.txt files...)
Did a quick skim again and seems a lot of the complaints are outdated by now, but probably no hope to see the author to update their rant.
I've been using YAWS as my web back-end for work projects, and a lot of my co-workers either raise an eyebrow or straight-up balk at it. Fair enough, it's pretty obscure, and the syntax isn't super friendly.
But then I watch them endlessly upgrade libraries, maintain toolchains, deal with exploits, etc etc, while my code sits on decades-old nuke-proof bedrock that no hacker in their right mind would waste time targeting (and likely would find impenetrable had they tried)
A lot of people sing the praise of everything being type safe, but I think the dynamic typing of Php and its synchronous nature are what make it so productive.
Also, at least compared to its C# Frankenstein cousin, uses a fraction of the resources to do MORE work, that still amazes me TBH...
I ask as the statistic seems to be projecting that it is the most popular amongst people, but it feels like it is a legacy language. Maybe adding in how much new server unrelated to the legacy apps are written in PHP would be a good contrast.
https://en.wikipedia.org/wiki/HHVM
It looks interesting to me since it is written in PHP, C++, OCaml and Rust.
Which I suppose you could argue, since it's likely passing through apache/nginx, which is fronting wordpress. So maybe 'C' is the most used.
Most wordpress freelancers don't code, they configure or install plugins. Somebody using rail, django or laravel is going to code.
Without this stat, all the other numbers are irrelevant, except to tell how many sites leak implementation details unnecessarily.
I'm surprised by JS low numbers too, I would have thought it was close to PHP.
"Anyone" can make a website with WordPress, but how many WordPress websites have programmers writing code for the website?
They say they use publicly available information about sites, plus scraping metadata from the sites, but do not reveal the blend between those sources.
If they're relying primarily on scraping (which I have to think they are, given the scale of the operation otherwise), they're really measuring "what proportion of sites make use of languages which we can easily fingerprint in their stacks".
What I think this is telling us is that WordPress is popular, that WordPress is written in PHP, and that PHP is profligate in its use of headers that announce its usage. That doesn't seem very interesting.
And yet here you are defending PHP and indeed claiming that 'A fractal of bad design' was "particularly popular with" people who haven't written any PHP. Your poor paste is also not a good argument.
It was a completely terrible language and now it's merely mediocre. And yet, it has a particular niche because among other reasons lots of cheap bulk hosts throw in PHP hosting in their default package. It's popular for the same reason all those 1980s kids learned BASIC. BASIC isn't a good programming language, but it is a programming language and there were few other choices available to them.
I claim so because the article was, and is. It's not me defending the language per se - I have no particular feelings or preferences for PHP - but just setting the record straight in the same way I'd reply to a false or incorrect statement on any other topic. I've seen more than enough unsubstantiated lamenting over PHP from people with little or no experience of the language. The article is more than anything else cited in blasé fashion by commenters who disappear after coughing up a link to the article, failing to follow up with actual solid arguments when asked why PHP would be incapable or unsuited for its tasks. I don't know what paste you are referring to. All of my comments are my own.
> It was a completely terrible language and now it's merely mediocre.
A terrible language is one that just can't get things done without irate jumping through hoops, but that's simply not the case of PHP. That's an objective fact, not a subjective opinion or feeling. While I don't use PHP much these days I still know the language very well, and on that technical and substantial merit I disagree.
Most discussions here happen around new/exciting/cool/weird technology. And don't get me wrong, I love those discussions! That's why I come here!
But reality outside of this bubble is people building and maintaining web apps as efficiently as possible and PHP hasn't stopped being very efficient. On the contrary, it's getting better with time.
Interestingly enough, Ruby (my personal interest, here) has been steadily gaining share in that chart year over year, despite not being "cool" anymore.
If you ask me, it's good to have a dose a reality from time to time!
An yes, then there's Drupal, Laravel, Symfony, and many others, and they're going strong too. Heck, even Joomla is actively developed even though it's probably small enough today to be considered legacy.
Perl is still heavily used. I wrote more than 2K lines just last week, lots of it is throwaway. But hey not many languages make it easy for you to write thousands of lines of throwaway code in hours.
It's still the most useful language in the backend/unix world. This comes from me, who actually writes lots of Python code. But I wouldn't use Python where I use Perl. It would just make me slow and it wouldn't get the job done just as well as Perl.
It's not used as frequently for web dev, or other places where Java is used. But it's very good at what it does. Glue language for the Unix world.
But, I'm pretty sure there's plenty of new projects being started nowadays in PHP, Ruby, Java, etc, because they're the most effective tool for the job.
It's just that this is not news. News is yet-another-standard-tool-written-in-rust.
Ex. I had to implement a task that would need to check if an image is similar to other image (not related to porn/csam). I implemented it with just a few line of PHP and no 100+ package dependencies. How? I run a linux CLI app from inside PHP, super easy.
but, but , you can do it with node too, - yes, but guess int he past in a node project, soem dev instead of calling ffmpeg directly he npm installed some shit package that called ffmpeg. The package was basic and it did not include or options needed , some other dev would have installed other package to get a new ffmpeg feature, /
I removed all those packages and done it directly.
My point is that we need to use the best tool for the job, if there is a CLI app or Java program/library that solves your problem a developer should present teh client the truth "I can solve your problem using this in 1 day or I can rewrite it in CoolLang and CollFramework and CoolPacakgeManager and CoolTranspilter with 100+ shit dependencies in 1 month. I am afraid many developers are choosing the last option to pad their CV and pump their ego.
I would say is also the ecosystem, PHP has a bit ecosystem and it can always use all the Linux applications (once in a project I integrated PHP with node program puppeteer) so there is no limitation, I miss more features in JS then I miss them in PHP.
I am sure the stats are somewhat off due to what others said about it being harder to detect Python, etc. But it's probably not that far off, this community greatly overestimates the usage of more "developer friendly" language combinations like Python+Django, etc.
What people really want is a solid CMS or off the shelf product they can tailor to their needs and since pretty much everyone of the most popular CMSs (Drupal, WordPress, Magento, PrestaShop) is PHP based this is no surprise.
That leaves a small portion of asp.net CMSs (Kentico, Umbraco, episerver, dotnetnuke, etc) and a bunch of hosted solutions (Wix, SquareSpace, etc).
Modern languages have also time and time again forsaken the ideal of making development LESS COMPLICATED than prior languages, and this is why they don't take over markets. Creating more abstract languages just to do the same things that PHP, Python, Java, JS, and other "legacy" langs have accomplished (over many years) does not make sense. Too many people get credit for reinventing the wheel these days and it's a distraction from truly game-changing innovation.
Relevant and reliable function resides in a separate lane than innovative new solutions. They shouldn't be hyped and rushed to market as "PHP killers" simply because they generate buzz and new contract money.
And FTR... If you still have to compile code in 2021 prior to running it, you're burning a lot of extra valuable time off your life and away from your family in frustration just to find out that the advice on Stack Overflow was not relevant to your framework's new update, and you'll regret the lost years on your death bed... probably... Sorry, That had to be said... :P
I almost never run my code. If it compiles I know it's correct.
I write native Apple software (Swift/UI/App/WatchKit), and my server stuff is PHP (and works great).
I like to spend as little time as possible on the backend. I totally admit its not my strong suit, so having a robust, highly-supported, standardized, performative, language like PHP, with a gazillion assistive resources and examples around, is nice. I've been writing stuff in PHP for over 20 years, so I sort of know my way around it.
I'll be expanding my Apple native stuff into the new "pseudo-reactive" realm of SwiftUI, but I don't really plan to keep growing my backend chops. PHP is doing fine for me. If I need anything else, I'll hire the talent.
To make a slightly problematic, somewhat poor taste analogy: 50% of the worlds houses (not a real stat, I’m lazy) have sheet metal roofs. All of the following are likely true:
- sheet metal roofs are wayyyy better than nothing for keeping the rain out. If you can’t afford anything else, definitely use them.
- Most people with sheet metal roofs would probably prefer something else, and would choose something else if the option was on the table.
- The prevalence of sheet metal roofs as a roofing material says less about sheet metal’s awesomeness as a roof than it does about factors that have little to do with sheet metal roofs (like global inequality).
- If you talk to construction workers in developed countries, they’d grant you that sheet metal roofing is quite prevalent worldwide, but they’re more interested in other materials and techniques that provide real substantial benefits.
That being said, I know a fair number of PHP developers. None of them are in SV or Seattle. They are in cities many have not heard of. They're all over. Some do public sites. Some do company internal web apps.
Take a project like Symfony, a PHP framework. It's popular but not the most popular. Now, take a look at the download stats for its packages [2]. They are large.
There is software development happening all over the world. A bunch of it is in PHP.
PHP is great fit for that, because all dependencies are part of the system updates in that case.
With all due respect, that is one hell of a bubble :). Plenty of companies use PHP (not just WordPress) and there are plenty of PHP devs who work with core, symfony, Laravel etc.
PHP is battle tested and even though it has its quirks, you can never go wrong with it if you are looking to build a web application.
P.S: We are hiring web developers for our company and PHP experience is preferred considering our stack.
I think your experience is probably limited then. Or you're not looking for them. ??
People from other languages don’t seem to want to believe it.
I don't think a lot of new companies are based on Ruby anymore seeing on how there's hardly any talk of Ruby anymore. But that's just an observation.
I am curious about that Scala number though. 2% of 10 million is quite a lot: 200,000 Scala websites? I would have never guessed!
I am actually finiding it difficult to get good paying jobs in Ruby and thinking of moving to Typescript.
1. Yes there are lots of Rails jobs but they wanted senior or at least mid level people who learned the deep nitty gritty of Rails at other companies. Few companies were willing to hire you as entry level to work on the job. The few entry level jobs had an ocean of candidates from the bootcamps.
2. I hated looking at Ruby code. Coming from a Java/C# background in college, it just make no sense to me and was ugly. I learned that while there are a billion guides on how to build basic Rails apps, there is very little on doing more complex things. A lot of that knowledge is just spending the time in a job learning a lot of things you can't learn in a book.
Now that I have internalized MVC architecture much better now I have considered going back to Rails to learn what I couldn't comprehend back then but every time I think about it I think about all the horrible nights I was sitting in my basement depressed that I was forcing myself to learn this crap and getting nowhere.
3. I should have dropped it much sooner. Instead I dragged myself in misery day in and day out and entered a deep depression trying to get some position....anything in Ruby/Rails.
4. I even resorted to unsavory tactics such as super fuzzing my resume just to get my foot in the door and ultimately bomb final interviews when asked about the inner working of libraries such as ActiveSupport among others. (Like seriously? Did I have to read all the C source of Ruby to get some basic job?). This fuzzed resume got me in a position where I was getting a 90%+ callback rate and the majority of them led to the final technical interview where I would end up not knowing some Rubyism or having difficulty solving a Ruby question in their existing codebase. Many rejections were due to the fact that while I solved the problem, I didn't solve it in the "Ruby" way. I guess Java/C#/C ruined my brain. I am not worthy of Matz's greatness.
Eventually through sheer dumb luck I managed to get a Angular2+/Flask position at a super large oldschool company only due to my nice manager knowing nothing about the tech stack so he took a chance on me. I thank god for this opportunity as I was maxing out my credit cards trying to survive. This low stress position allowed me to fall in love with Angular and Python and I have never looked back on the horror that is Ruby/Rails.
Thinking about my experience now(and this is subjecting to my experience interviewing at dozens of NYC companies), I noticed Rails being used at all these silly hipster startups that mostly produce garbage anyway. I remember interviewing for this "art studio" that was producing a revolutionary camera system in partnership with an Italian company. The company was just one giant room with round tables where Rails people would be making the web backend that connected with their camera system. They produced the product and got rid of their Rails people a year later. That seems to be the nature of the ecosystem. I saw so much of that in the Rails community.
6. This experience taught me that the community of the language will evidently affect your day to day life and overall career prospects. The niche nature of Rails allowed people who got in super early to make massive mounts of money (hence all the Senior Rails job ads promoting 200K in NYC) but you are mostly stuck working for these "cutting edge" hipster companies and if you don't or want to fit that scene then you are SOL. Likewise Angular and Python attracted some startups as well as enterprise companies due to Microsoft's backing and its excellent library ecosystem for enterprise applications. The community is quite nice and has opened my eyes to what it is capable of. You can find startups using it or relax in an enterprise shop. Was a world of difference from Ruby/Rails.
Sometimes I shed a tear for losing almost two years of my life to this. But the reality is that I made many poor decisions from my college days up until I got this Angular job.
It doesn't help that despite the impressiveness of the 15 minute blog demo, Rails has always been somewhat difficult to get up and running, particularly on Windows, and it seems like that has only grown worse over time.
And the corporate world move slowly.
And dev cost money. Most websites don't need more, they were fine 10 years ago and still are.
Although I'm not sure we have the whole story. I'm assuming we get high stats because of wordpress, which is not a good indicator of language popularity, but rather of platform popularity.
I'm also quite happy to see Ruby continuing to grow in this report.
When interviewing developers, I always ask about their experience in handling sites large enough to comprise a farm, not just a single server. In all my years of searching, I've only ever come across one developer with such experience.
But here on HN, it makes it look like the multiple load balanced web and app servers we've got across multiple tiers, not to mention Docker and k8s, are on the small side.
There's definitely a big difference between those conversing here and "the unwashed masses".
I seem to recall a perl CMS - was is movable type? - that required mod_perl. This certainly gave it a perf boost against other CMS, but the overhead in setting up and maintaining a mod_perl system, and dealing with making code updates, was huge compared to PHP. I think these qualities continually get overlooked, decades on.
No regrets because the last few years, never has an ecosystem been so bright.
I'm convinced if you are a typical medium-sized business trying to recreate that technology with Node, Express, React, and a billion NPM packages, your are doing things the unnecessarily hard way.
PHP has a huge market share in web sites, but much less in web apps.
Take a look at the YC job board. A surprising number of the companies use RoR.
The worst aspect of it is how unaware HN is of its biases.
I have a comment from yesterday that is (rightly) sitting at -4 (https://news.ycombinator.com/item?id=28501661) that seems relevant: The rise of Ruby on that chart can be directly correlated with the rise of Shopify.
Elsewhere they note that Shopify "accounts" for 3.9% of the top million websites. The bulk of Ruby's increase.
Though I'm suspicious of the accuracy of their numbers. Most modern tech stacks don't announce themselves in the way that PHP did, and they clearly used curated metadata to attribute some major content engines (e.g. Shopify = Ruby, Wordpress = PHP, Wikis = PHP, etc), which means that anything outside of the top identifiable content engines isn't going to have proper attribution.
Further, note that literally any use gets credited. Look at the "popular sites using Shopify" at -
https://w3techs.com/technologies/details/cm-shopify
Overwhelmingly they get the shopify/ruby credit for linking to a minimal checkout experience on a subdomain. That seems...incredibly dubious.
Still neat though. But what it really demonstrates is that product wins, not technology. Wordpress is clearly a winning product. Shopify is a winning product.
PHP isn’t something I ever want to touch again (its libs are wonky and I dislike the syntax choices of the last years) but the execution model was sort of nice before the frameworks (an entry point with a clean state you can work yourself through).
The statistics are a bit misleading though. Just because 80% of the sites run PHP in some way doesn’t mean there are that many Jobs. A lot of the work with PHP world is not necessarily going to be PHP work (a lot of HTML, JavaScript and Plugin configuration) and there is complexity in learning your way around a system well enough to build plugins. The jump from beginner to expert has become harder for a new PHP programmer because the real programming is hidden behind a wall of already existing code that just needs to be installed, configured and customized.
I’m glad I got out when I did because I get to actually program APIs and Single Page Apps rather than just being a glorified PHP webpage mechanic.
There's not much wrong with modern PHP. Symfony and Laravel projects are a joy to work with. The standards and tooling is there too with composer, phpunit, PSR-4.
I don't think you've ever been into PHP if you was only wrenching in old projects.
The next version is even going to improve on its weakest point, concurrency, with Fibers: https://php.watch/versions/8.1/fibers
Sure we all remember the bad old times and the horrible legacy projects that are still around but let's no forget PHP allowed the average Joe to hack up his own dynamic websites without jumping any hurdles. It helped democratize the internet for a while.
I really don't get why PHP is not more liked in hacker circles. Probably needs some new languages with slightly different syntax that transpiles to it for it to be hip again.
I'd also love to see a study like this instead focused on "How much of the active web is wordpress?" and "How much of the inactive web is wordpress?".
w3techs admit as much in their disclaimer. The data and conclusions from it are junk.
> In order to obtain any information from websites, we rely on the websites themselves, their owners or their webmasters to provide such information. Some websites are more open to sharing this type of information than others. Some technologies may provide more means to reveal information about their usage than others.
If I were to work on a large scale web project on my own though, I'd probably still choose JS, Python, or Go, but PHP is a language that's won my respect.
They publish numbers that are very surprising to most people, like Python and JS are used on 1.5% of sites vs PHP on 79%, then offer some very handwavy text about the data ("In order to obtain any information from websites, we rely on the websites themselves"), and then offer a full report for $$$ where they probably more fully own up to how they come up with this clearly flawed data.
In the end the paying customer sees the shortcomings of the data, feels relieved that their assumptions weren't invalidated and has invested some money to doing due diligence.
The Stack Overflow Developer Survey [0] is my go-to source for this kind of thing, and it has very different results. Of course, it's measuring overall popularity while W3Techs is looking at "server side programming languages for websites."
Here's how the ranks compare:
Language W3Techs Stack Overflow
PHP 1 11
ASP.NET 2 8 (C#)
Ruby 3 17
Java 4 5
Scala 5 26
JavaScript 6 1
static files 7 2 (HTML/CSS)
Python 8 3
Cold Fusion 9 N/A
Perl 10 27
Erlang 11 35
Miva Script 12 N/A
[0] https://insights.stackoverflow.com/survey/2021?_ga=2.2362093...https://w3techs.com/technologies
https://w3techs.com/disclaimer
They are not measuring cron jobs, mobile apps, services, games, etc, all large sectors within the field of programming.
If we combine this survey with the Stack Overflow survey we can conclude that websites are built with PHP in the backend and with JavaScript in the frontend, nothing really chocking.
One problem with the Stack Overflow survey is that I'm not sure that the community of more esoteric languages like Erlang even uses Stack Overflow, I guess that is why it is at place 11 for W3Techs and 35 for Stack Overflow.
Or claim to.
Also, I'm surprised Python isn't more popular. 1% is (comparatively) tiny for a language that popular.
Another point of data could be: https://insights.stackoverflow.com/trends?tags=php%2Cpython%...
The same goes for pretty much everything on that list which isn't PHP or .NET.
Also, in my experience, web devs tend to hate python as much as they do PHP. I've worked at two places so far where python wasn't allowed to be used in web services at all without a Very Good Reason. Choices were Node or Go.
The next big thing there is Typescript.
For me its the perfect language.
I run a bunch of websites doing various little things. One is a Wordpress blog. I wanted a blog-like site so that myself and a few non-technical friends could write and publish articles on a particular subject. The easiest and most reliable and well-supported solution was to just install Wordpress. Throw in a few plugins from the Wordpress repo for any functionality it doesn't already have.
I don't understand PHP particular well, and don't feel very inclined to learn it. But hey, I don't need to, Wordpress already works fine, and there's probably already a plugin to do anything I might reasonably want to code up.
I find some of the security practices disturbing - it seems to be standard practice for the web process to have full write access to all the code files and the database. If anyone ever compromises the server code, guess they have full access to pretty much everything. But whatever, it's a standalone server with nothing but the blog. I have an Ansible playbook for the setup, so I can kill it and spin up a new one if it ever breaks.
So there you go, I'm responsible for a PHP site without writing any PHP. Probably lists like this represent a lot more low-skill deployments of existing proven codebases than bespoke projects.
There's probably something going on about ease of deployment too. I much prefer writing Ruby/Rails apps, but I don't actually know of any existing ones that I'd say are easy to do a low-skill deployment of in the way that PHP is. The nice part about things that are terrible from a security standpoint like the web process doing all upgrades and plugin installs is that it makes it much easier for less-technical people to deploy and manage it. Or people who are high-skill, but don't feel like applying all their skills towards a task that already has a straightforward solution.
There are other statistics around the web for language use.
For example:
- As many pointed out, are the majority of PHP just default Wordpress sites? I would rather know who built in a given language rather than installed a site that happens to use a language. - I use to be in the banking world and it as all Java (or C++ for algo trading, Scala for data processing, but never NodeJS), but I haven't seen many new startups using Java unless the founders came from banking. The industry made a difference. - How old is the company - a 30+ old company might have Perl.
Also, a bit surprised at Javascript, AKA NodeJs. I thought it would be higher.
It's only later when they grow they hire a developer and by that point they may be committed to PHP due to the sunk costs.
250 Ruby ads
420 PHP ads
1600 Java ads
1600 python ads
1300 .NET ads
PHP - 12316 jobs
Ruby - 1175 jobs
Java - 5902 jobs
Python - 10051 jobs
.NET - 2353 jobs
Adding a few of the others:
C# - 2562 jobs (I suspect those .NET also can be interchanged with C#)
C++ - 1711 jobs
Go - 3925 jobs
Rust - 382 jobs
Feel free to double check my results. Like it or not, Upwork is the largest freelancer site.
The disclaimer page also makes it clear that they don't analyze anything that requires interactions like signing in. Together with the subdomain policy, I suspect for any business where the landing/marketing site and the core business offering differ in technologies used (which is especially common for SaaS products), they will only pick up the marketing site. They also seem to allude to some sort of webmaster self-reporting mechanism though, not really sure what that means.
1- They say they only consider what the root of a domain is using, ignoring subdomains. Speaking for my own org our real work happens in subdomains running Django apps. Our www is just a WordPress site because we don't want to spend cycles writing/maintaining a simple blog engine.
2- For a lot of sites using e.g. Django there wouldn't be an automatic way of determining what language was used.
Luckily for the majority sites on the Internet a CMS is exactly what's needed, and very often with more minimalistic custom development (plugins will take care of most of your needs). Thus with WordPress/Magento/Drupal being the heavyweights it's not at all surprising to see the statistics as laid out.
What I would love to see is a similar chart focused on bespoke applications, more like the kinds we would consider building for solutions, startups, and companies here in the HN space. I would guess it would probably hew closer to the stats in the TIOBE Index [0], but again one would want to filter specifically for web application development. Now those are some stats that would be very interesting!
tons of companies use php, my company uses it even for modern development.
get out of your own bubble dude
Another survey : https://insights.stackoverflow.com/survey/2021#web-framework... Puts the first PHP web framework not even in the top 10 of uses, behind framework in JS, Python, C#, Java.
How is this data even gathered ? And what is usage ? Do 1000 Wordpress count as 1000 servers ?
I suspect one would see the former drop off a cliff, whilst the latter will always be quite high -- due to first-mover effects.
Thing is those OLD projects where new when I was working on them. When I got into WordPress back then It was NEW. When I got in to jQuery it had 3% market share and it was the underdog. A lot of the arguments you might be sick of hearing about, well back then they where valid.
I used to toy around with Haxe: https://haxe.org/
The idea in principle is great (use Haxe the language on your machine, then Haxe the compiler to produce PHP code and upload it to a cheap hosting somewhere), but I've never found a real use for it.
Though it seems to be also great for game dev. The show case of games written in Haxe is quite impressive:
The security track record of the language speaks for itself: https://www.cvedetails.com/product/128/PHP-PHP.html
It's been battle tested and lost many battles.
To me PHP is an ugly language, with heaps of quirks and weird api's. The way it mixes markup and logic is gross.
That being said, I do like some parts of it. The way you compose pages by just writing "include" is nice. The way the server spins up processes for every request like a micro-service is nice.
PHP does have an elegant simplicity that many languages and frameworks lack these days...
Wordpress does mix the two, but Wordpress is definitely not a good example for modern PHP development!
Kind of tangential, but I've found a similar thing in the React framework: After all these years working towards splitting UI with logic, React asks me to hardcode the graphical components in a return (<module1></module1><module2></module2>) function. It is something I just cannot grok. I prefer frameworks that let you separate the UI elements from the logic that drives them.
We don't do that any more. You separate logic and view like in any other language.
In fact some people don't even use PHP for templating anymore but a domain specific language. (Though sometimes having a fully features programming language for templating can be nice so jury is still out.)
Honestly I am more grossed out with the stuff that some modern frontend frameworks are doing these days, where there is not separation of styling, markup and logic anymore with that thing that is like html but not totally html. I see the advantages but not sure how this will turn out in the long run.
One of the great things about PHP is that that is still ever-present. It's fairly easy to get started utilizing PHP, just as it was 15 years ago. The basics of PHP have not gotten much more complicated over time.
Open a text file, write out a bit of PHP, save it, run it somewhere (locally or on a cheap host). Any Joe can still do it. I can't think of much that has gotten more difficult about getting started with PHP versus the first time I used it.
PHP 8 for our API, JS for the app that consumes it - sharing code both server-side and client-side.
It works really well for us.
Development on a modern version of PHP with a framework like Symfony or Laravel is so very different to development on old PHP5 versions.
edit: PHP 7.x and 8 let you do things like:
- no automatic type conversions
- typed function parameters and return types
- typed object properties
- named parameters
All of these are little niceties but they add up to making it fantastically easier to avoid stupid mistakes that used to be common with PHP.
The language itself at the time was mostly useful because you could execute a script made of HTML (or anything really) with some embedded magic tags interpreted as PHP instead of the opposite where you had to do some sort of template engine.
Kids who want to seem cool have moved on to Go and NodeJS, so PHP is mainly left with people who got some experience and mostly know what they are doing, save for those who really just twiddle Wordpress until it sort of appears to do what they want it to do.
I suspect that PHP's ultimate fate is to become another Perl — a quite mature platform with very few people tending to it, obscure, with a community of very expensive veteran programmers.
1: https://insights.stackoverflow.com/survey/2021#technology
Only developers complain about PHP. And even that isn't really warranted anymore as PHP has grown leaps & bounds since most of the hate.
I just inherited a PHP project that it's a nightmare. It doesn't make any sense. It works on PHP 7.3 but the quality is worse than the old PHP 4 stuff.
It is so easy to write good PHP code nowadays but most devs don't do it. They just go for the old ways, with spaghetti code, no clear architecture, etc, because it just works. They don't have to think, just type. Thats why people hate the language. They see the bad code and they think the language is poorly designed.
OTOH many bootstrapped or legacy companies pick long established technology to build their products as they are only selling product implementation, not the idea of changing the world or whatnot.
It might also be the client simply wants php. They don't want to pay to maintain anything extremely over-engineered.
Also, in general passing untrusted input to shell commands is probably a bad idea. FFmpeg has had many CVEs over the years and taking an upload from a user and piping it to a CLI command is asking for trouble. There are considerations beyond just doing the easiest thing that could possibly work.
This is why you escape the shell command arguments, but if you blindly npm install a shitty wrapper you probably hit the issue with security issues. Sure review of the dependency would be great but I did not seen many devs doing it, if they would have reviewed the ffmpeg wrapper would have noticed the simplicity and implemented themselves and on top of that learned some new stuff.
>Or, maybe developers who choose other languages are also competent professionals
I did not say that all of node developers are beginners, I am saying that many developers are not using the right tool for the job but use the cool tool for the job and some developers just blindly npm install shit because this is the only thing they know.
And I can confess I was guilty of this, on a project I propose to use Qt4 over Adobe Air because I was fan Qt and hated Adobe , turned out in the end I was forced to use Adobe Air and I loved it, for what we were doing it was the best tool for the job.
Agreed. For any one-off (or occasional) task that in any way involves juggling text (which in Unix CLI world is nearly all of it), perl is still the fastest way to get done.
Back in '92 (roughly when I started using perl), its regex support was revolutionary. Today, all languages have decent string handling and regex support. And yet, none is quite so naturally well integrated as in perl. So here 30 years later, if I need to pick apart and recombine text, give me perl.
Besides merely being an old technology doesn't mean legacy. SQL is fairly old.
...showing my age with this comment
The survey does not measure deployed server languages.
LOL... j/k. :P
Architecture design and Agile now compensate for the traditional compile/test procedures... DEV > STAGE > PROD
When it's practiced with discipline it works well, catching most issues prior to the system going down anyway on deployments to PROD :)
Of course I do. No other environment is identical to prod, real data, real users, real scale.
I think that was even the main point! If I'm not mistaken, OpenFL[1] is an effort by the same people.
I don't disagree that it was useful — especially for having such a simple “upload a file, hit refresh” workflow — but popularity can work against you when it encourages optimizing for easy starts over long-term maintainability and a huge number of people learned dubious habits and aren't quick to switch.
https://www.php.net/supported-versions.php https://www.php.net/releases/8.0/en.php
The thing with PHP is it's very easy to understand in comparison with Perl. When Facebook did a study on which languages take the least amount of time to onboard new hires PHP won every time. It's also why they use their own version of PHP in house (Hack). It's 95% same thing with additional features like async built into their engine.
Of course, that's in relative terms. It's nowhere near the size of the Java, JS or even Python market size, but demand is strongest than ever and salaries show that, too
I think this is probably the biggest part of the HN bubble: the idea that "tech hubs" like Silicon Valley make up all, or a supermajority, of tech workers.
I've never even visited the west coast, never lived in a town larger than about 20k people, and frankly never really want to live in a city. Yet I work in tech, and have my entire adult life. (At this point, I am, in fact, primarily a PHP programmer.)
And I'm hardly an exception.
Nearly every company over a handful of employees needs tech support, programming, a website, even servers managed. Many of these will hire internally. Others will turn to contractors—who are also locals.
Silicon Valley, with its high concentration of tech workers and ludicrous salaries, is very much the exception here, and a lot of HNers would do well to remember that, lest they end up looking as out of touch with the real world as Lucille Bluth asking about the price of a banana. [0]
Not really a big deal. I'm pretty cutting edge, on the frontend (native apps for Apple systems, in Swift), but a bit stodgier on the backend (I use PHP). I’m not surprised at all by the survey results.
PHP works great for me. If I need something different (not an issue, so far), I'll hire it in. I'm actually fairly good at big projects in PHP. My code is maintainable and high-quality. It may not be “leet” PHP, but it works well.
Here’s an article about this kind of thing, that is a bit “meta”: https://veekaybee.github.io/2019/05/10/java8/
For at least the last decade I've been pondering re-implementing it in some fancy new language - but as it just keeps working, it slides down the priority list.
The more likely scenario is that a framework with a front controller is used, which is invoked by php-fpm, proxied by nginx.
It's easy enough to do, though.
Most newbie coders would start out coding their own blogs in PHP/Nodejs or Python on shared hosting, some web host use web framework as well.
It's legacy is a hell I agree but quite irrelevant and getting old.
You know the saying “There are two types of programming languages, the ones you love and the ones you use”. That sort of thing. AND it still doesn’t invalidate my points:
1) PHP is relevant because of the software already written in it and that will not just get rewritten because PHP isn’t HOT anymore.
2) If you are a new PHP developer you are most likely going to be shoved into a job that has more to do with configuring, maintaining and customizing those preexisting systems.
3) Because of that getting from being a beginner PHP dev to an expert PHP dev is going to be harder than it should be.
4) There are going to be less PHP jobs in proportion to its usage out there because so many of the PHP jobs fall into the configuring, maintaining and customizing schema in comparison to other languages.
The changes and improvements are dramatic and wonderful. Improvements in speed, security, error processing, functionality/integration with databases, Composer, etc...
While I am not suggesting you go back to PHP, but things are simply not the same anymore.
I think you should realize that when someone expresses an experience people often times read it as warning.
And your experience sharing (as a warning to others) is not useful to the current state. And therefore could be considered damaging to other people's perspective without a counter "experience" being shared.
I have my experience and the fact that it aligns perfectly with yours up until you stopped using PHP should be appreciated for what it is.
But... is it much easier to find good devs in any other tech stack? I don't see it, personally. My ruby friends complain it's hard to find ruby devs at all, and harder to find good ones. I do see a lot of JS/node folks that get accepted as 'good', but when the rubber hits the road, the code is often still... meh - cut corners, SO copy/paste, etc.
I see bad node and bad js and bad python... but somehow the languages and stacks get a pass and "it was just a bad developer". But if you see bad PHP, people think "the whole language sucks". Completely inconsistent.
Compare that with deploying a hello word website in python, java or elixir.
I highly encourage using this template for all new projects
The project not only doesn't use composer (well, it does now because I needed some components) but it has the same third party components duplicated or triplicated around the application. It looks like they downloaded them Everytime they needed them. Some of them are modified to make them work on newer versions of PHP. And the views and the logic are mixed together in big 4k lines files with no functions. Html, js, PHP, tens of SQL queries on loops, all mixed together.
It's so bad it looks that it was made like this on purpose.
The funny thing is a pretty important project for a pretty important and unique customer.
Just want to nuke everything to oblivion.
But there is hope, sometimes it can be better to inherit badly written repetitive & copy-pasted code, rather than badly written abstractions.
Badly written abstractions can be really hard to get out of years later because it tends to be viral all over the project, however when there are no abstractions at all, you can decide them right now, you are in charge. Bit by bit you can unwind this mess to something grander, to your own creation. Good luck. Praying the PHP prayer for you.
Note that I enjoy both PHP and JavaScript immensely. But, my God, some of the code that I've seen in both languages...
2) Part of my point was PHP, regardless of what you may think of it, is not bad enough that any of that code needs a rewrite. Still PHP people concentrate on me not liking PHP and argue with me about that and nothing else. Why is the reflex in the PHP community to do this so strong?
As for the reflex... PHP has had this bad reputation for so long, that most PHP programmers (IMHO, just an opinion!) feel looked down-on for using what is actually a pretty decent system now. Viewed as inferior programmers for preferring it.
But you can use modern PHP in your own theme or plugin if you want.
For the last couple weeks I've been thinking I should look for a new jobs as it looks there's no future here.
You start by setting up the standard router for all URLs when the php file doesn't exist. You then setup your router to answer somefile.php or whatever file you want. You then have that route execute your own class. You simply delete the original file and it now loads from your router. You can typically copy/paste the code from the file into a function in a class without any modifications. As you go you can get rid of includes / requires all over the place because now you've got auto loader configured so you can just call code from other files at will.
So then I just repeat this process. Sometimes it takes years but I can typically make a huge dent in most systems in the first few months.
If I don't get buy in I do it anyway for any code I'm asked to work on cause it makes the work better and there's no reason not to do it at that point.
I actually kind of envy you. I enjoy refactoring projects like that. You can typically bring that 4k line file you mentioned down to just a few classes and views.