105 comments

[ 5.1 ms ] story [ 188 ms ] thread
PHP 7.4 isn’t even available in Ubuntu 18.04 LTS without a third party repo.

I wish PHP.net could get some support to provide official repos of their own. It would make upgrading easier.

If you want newer software, why not upgrade to Ubuntu 20.04 LTS or even just the latest Ubuntu?
I mostly run 20.04 or 18.04 with the repo. But a lot of people won’t upgrade or use a third party repo.
“LTS” means “stuck with obsolete software”.
I absolutely think Ubuntu's update cycle is a big part of why PHP 8 doesn't have a higher adoption rate. The PHP webapps I write are all served by Ubuntu servers (on 20.04 LTS) and there isn't an official PHP 8 package yet. Even if you're running 21.04, PHP 8 still isn't available as an official package. Ubuntu 21.10 was just released and finally shipped PHP 8 packages, and PHP 7.4 support ends in roughly a month. Anyone sticking strictly to LTS releases won't get official PHP 8 support until ~5 months after PHP 7.4 support ends.
Probably due in large part to WordPress
WordPress is the Excel of Web Development. Especially when people keep building complicated flows with it, for which it was not designed for. OTOH, the UI is known by everyone and is intuitive, so from a users perspective "it just works", and "you can do these advanced stuff if you learn scripting a bit".

Many projects explicitly look for freelance WordPress developers, it's a huge market and I respect it deeply, but I'm glad my career put me in a position where I can totally ignore it.

Exactly. But Wordpress has been a resounding success because there is such a demand to own your data, brand and relationships. To have CONTROL over your own site and choice in hosting.

There has to be something like Wordpress for Web 2.0, so we can break the oligopoly of Facebook, LinkedIn, et al. and move the world from digital Feudalism to a Free Market:

https://qbix.com/blog/2021/01/15/open-source-communities/

I think it's because many websites are incrementally built on. It's a case of tacking on this extra bit of complicated functionality vs rebuilding the entire site from scratch and migrating existing content to it in a new tool.
Most businesses care about getting stuff done and making money, not about the merits of the tools being used. In one financial firm where I worked, they were using Excel for running financial models (I am not making this up). It will often crash, users constantly complained - but when I offered to rewrite their models using databases and a programming language, I was instantly shot down. They didn't want to touch a system that has been working for a while, even with all of its problems.

So they stuck with Excel, even when they had access to a programmer.

Programmers can laugh all they want at Excel, Wordpress, PHP etc - but these are tools that get stuff done quickly and make businesses a ton of money. So businesses will continue to use them, even if there are much superior tools around.

> Programmers can laugh all they want at Excel, Wordpress, PHP

I don't laugh at them. I see many people more clever than me working with tech I don't like, and making more money than I make. It's completely OK. I even wrote some PHP lately, and while my humble opinion generally hasn't changed (that I'm too dumb to use PHP), it's clearly VERY fast and easy to get started, while there are many people throwing money at you when you are good at it. If you are competitive and can work with weird setups (which is a given for many customers seeking freelancers), and under stress, then why leave money on the table.

Some may take what I'm saying like a snipe disguised as humility, but I'm completely honest. No sarcasm at all.

This dubious 78% statistic has been discussed to death in https://news.ycombinator.com/item?id=28510520.

The submitted title is badly editorialized and leaves out the actual point of the article: only "1% on PHP 8" despite a whopping 78% total, if we take the dubious statistic at face value.

For the record, the submitted title is "78% of the Web Powered by PHP" at the time of this comment.

If you look at the web by urls not weighted by traffic, you’ll come across the unfathomably large swath of autogenerated spam blogs. For every legitimate business in the world there are 100 people trying to ‘make money online’ paying for scripts that register and post spun content on thousands of domains. The long tail of the internet is an absolute wasteland. It’s tech choices should have little bearing on the rest of us.
Yes, thank you. The site's methodology disclaimer explains this is the percentage of sites for which they could automatically determine the language in use on the server. Newer web languages don't include a header telling you the language and version in use at all, and if web frameworks add one, security auditors will always make you remove it.

So the real statistic is 78% of websites that are written in a dynamic scripting language, don't get pen-tested, or don't care about security, are written in PHP. That's a very different statistic than 78% of all servers that will respond to an HTTP request.

PHP’s popularity is not only due to Wordpress.

The language is simple and accessible.

The ecosystem and community are ginormous. Are you stuck on something? A quick Google search has the answer. Finding PHP developers anywhere is also easy.

It’s fast. No, really. And keeps getting faster.

It’s easy to run directly on your local dev environment.

It’s boring in a good way. Evolution is incremental. Breaking changes happen, but nothing unmanageable, and every version is supported for a long time.

There’s not a ton of confusing options to choose from, with the risk that they will eventually become obsolete/un maintained. Laravel and Symfony are pretty damn good.

Need to get something done quickly, just for a prototype? PHP ‘s a good choice. You will get there quickly, even if the code is not something you’ll want to show off with.

Need to choose a language for a web application that need to be maintained long-term? PHP is not a bad choice either, for all the reasons mentioned above.

Everything you say is also true for Java or Kotlin, which are better languages and have even better backwards compatibility story. You also left out all the downsides of PHP so it looks more flattering than it should.

So while PHP is ok, why choose PHP when you can choose Java/Kotlin?

The only benefit of PHP over Java/JVM-langs is probably memory usage, which is generally not that important of a factor in today's environment where memory is cheap and devs are expensive.

I think unless you are already super familiar with PHP it's probably not the ideal choice. You could do worse, but you can also do better with Java/Kotlin/C# all of which have the good parts of PHP but none of it's bad parts, higher quality ecosystem, higher quality devs, better tools, faster runtime, etc.

> Everything you say is also true for Java or Kotlin

Uhh no. Getting a local dev environment set up for PHP is much much easier.

Writing your first line of code and seeing things run in a browser is much much easier.

Uploading a single standalone PHP file you wrote to your 5$ webhost via SFTP, with _no other work required_ and just seeing your code run on your website? Show me how to do that exact thing in almost any other web programming language. You can't.

No one said PHP was perfect, and I'm not here to defend all the problems, but to compare PHP's almost universal accessibility and ease of use (which is why it is so popular) to something like Java or C# is ridiculous.

If anyone thinks local dev with Java/Kotlin is hard they haven't tried it in the last decade. The years of WARs and application servers are long since gone, every framework you would interact with (Spring etc) are self-hosting, i.e even easier than PHP because you don't need a web server, you don't need to know what FastCGI is, etc.

If you pay for a host that has all this setup and SCP/FTP your files to it sure, but is that -really- easier than the local dev experience vs the Sprint Boot starter pack? I don't think so.

PHP has a built-in webserver for local dev.
It's harder than downloading WAMP, launching it and editing PHP files.
It's not.

https://www.jetbrains.com/help/idea/spring-boot.html

i.e Download IntelliJ, select Spring Boot, follow prompts to create project, press green button to run app. Click link in build output to open in browser, edit files for live reload.

To get equivalent usefulness out of PHP you would also need Laravel or some other framework, which if you want to do properly you also need Composer, etc. Ease of development is one area where Java is king these days, a LOT has changed in the last decade.

> i.e Download IntelliJ, select Spring Boot, follow prompts to create project, press green button to run app. Click link in build output to open in browser, edit files for live reload.

You're right, they are now at the same point in terms of ease of development. Deployment is close too (fat jar vs php files), though PHP still has shared hosting. And sure, Spring boot has more things that vanilla PHP.

But why would anyone make a big deal out of a slightly simpler (not necessarily better) deployment story? In any bigger project than a personal blog or stuff like that, deployment is merely tiny fraction of the process. If 5x the time is required to make things stable, then that is quite bad, no matter what the deployment story is.
We are talking about accessibility and ease of use as factors that power adoption.

If you want to talk about something else, we can do that too.

When it comes to agency work, with a lot of small to medium sites or API:s (in the $10k-$200k range) PHP is very convenient and there are a lot of choices when it comes to hosting and deployment. Dedicated WordPress hosts, Laravel Forge and Vapor, small hosting and VPS providers as well as AWS Lambda, AWS ElasticBeanstalk and AWS ECS to mention a few.
This feels a lot like comparing languages based on “hello, world” programs.

> Uploading a single standalone PHP file you wrote to your 5$ webhost via SFTP, with _no other work required_ and just seeing your code run on your website? Show me how to do that exact thing in almost any other web programming language. You can't.

You can do this with Go and you don’t even need your webhost to have any special language support. Moreover, that single file can be an entire program, not just a single source file.

PHP has this "upload a file via ftp and run it via the browser" thing. If you are already familiar with HTML, the upgrade to PHP is an easy step.
Conversely, with Java you quickly end up with e.g. enterprise application servers and you need dedicated people just to manage those.
That's not true either, especially these days will all the microframeworks.
Better is highly subjective, especially in this case.

Also, why would you distinguish Java/Kotlin/C# as something different then PHP? Java/Kotlin/C#/PHP they all mean the same to me. They're programming languages..

Static compilation, real type system, real runtime, static analysis, higher quality IDEs (IDEA, VS), higher quality libraries (Spring and ASP.NET).

They are in a completely different class to PHP.

That is like saying a Honda Civic is the same as an Ferrari F1 car.

> That is like saying a Honda Civic is the same as an Ferrari F1 car.

In that nobody uses a Ferrari F1 car to do anything practical?

I could have chose a better comparison but you really are completely misconstruing the point just to be edgy, i.e haha very funny but no.

Your bank is probably running 90% Java. Every large website you use may not be written in Java but relies on mission critical systems that are etc. It's an insanely practical language, in fact probably -the- most practical language and that is why it's chosen overwhelmingly for important systems that need a large number of developers.

Nobody's saying banks should use PHP as their backend though.
If PHP was as good as Java (which you are arguing) then they could. But they don't. Why is that?
There is no single dimension measure of how "good" a programming language is.
Again, good is subjective!

Most programming languages are 'good'. Some are just better in doing certain stuff than others. Doesn't mean the other languages are bad.

Different doesn't mean worse, or better, without context.

> you really are completely misconstruing the point just to be edgy

I'm misconstruing the point because I don't like analogies, especially when they only bring confusion. There's no need to bring cars into a discussion about Java and PHP. Programming languages are programming languages, cars are cars.

> It's an insanely practical language, in fact probably -the- most practical language and that is why it's chosen overwhelmingly for important systems that need a large number of developers.

Java being practical is part of it, its marketing to managers is also part of it. But being the most practical language for "important systems that need a large number of developers" doesn't mean that it's the most practical language for everything. To answer your first question:

> So while PHP is ok, why choose PHP when you can choose Java/Kotlin?

When you're a single developer that does lots of small projects, PHP works really well. In a way, it allows you to go faster at first. Depending on your business, that may be the most important thing, or not important at all.

While my bank is surely running 90% Java, I would bet that there are many internal applications that saves people a ton of time that are written in PHP. That's how it was at my last job at <BIG COMPANY>.

Yet people overwhelmingly choose Honda Civic over a Ferrari.

If Ferrari is so superior, why is that the case?

Hell why not buy a rocket ship. Its the most superior!

Oh yeah, not practical for most use cases.

I'm going to ignore the Ferrari Civic..

Real type system -> PHP has one. Static analysis is possible in PHP. Sublime, PHPStorm and VS Code are not high quality? Zend Framework, Symfony, Laravel are pretty high quality frameworks IMHO

It doesn't have a real type system. It's dynamically typed under the hood, type declarations are just hints in PHP, the code will fail at runtime not compilation time. Compare this to prod languages where your build with just flat out fail, you don't even need to run the tests! It will just tell you X var is not of type Y, try again.

There is some minimal static analysis. Nothing in the realm of what is available for production languages.

PHPStorm/Webstorm are decent yes, IDEA platform is pretty awesome in general but if you think those are good wait until you try IntelliJ or Rider w/Java or C# respectively. There is good reason why it's those 2 editors that made Jetbrains into the company they are today. (Note that these too are written in Java and Kotlin... which should also tell you something)

Zend/Symphony/Laravel are great for PHP, orders of magnitude better than what came before them, however they just don't measure up to Spring and ASP.NET in performance, correctness and tooling. This shouldn't be a surprise either, Spring has a long history of massive production users, everything that can be done has been done and the best patterns and libraries have been battle tested in the harshest of environments. ASP.NET has insanely large userbase because it's the only blessed framework on the Windows platform, which is way larger than the HN community gives it credit. It has insanely high level of consistency because of the massive scope of both the C#.NET standard library and the bundled functionality in ASP.NET and blessed libraries like SignalR.

That is to say, can you use PHP for web? Sure you can, you can even build some great stuff. But unless you are invested in it already these other tools -are- better, objectively better, not subjectively.

You can argue subjectively for Python, Ruby or Node.js - to me these are all in the same class as PHP and have similar quality frameworks (Django, Rails, Nest.js) but are all objectively inferior to the production languages.

I don't even get why this is controversial tbh.

I have used all of these, in fact I still choose to use some of them. I build things in Ruby occasionally, Python for some things and I started off doing web stuff in Perl and PHP.

As someone with a background in all of these scripting languages I don't think it's possible without some crazy mental gymnastics to not see how the production languages are clearly superior for almost all professional use cases.

I think the most likely case is people that think otherwise just have never tried them, at least not seriously enough to really grasp them.

> It doesn't have a real type system. It's dynamically typed under the hood, type declarations are just hints in PHP, the code will fail at runtime not compilation time.

Just like Java then? Your average Java code will be more solid than your average PHP code of course, but Java is far from free from runtime errors due to a not good enough type system.

> You can argue subjectively for Python, Ruby or Node.js - to me these are all in the same class as PHP and have similar quality frameworks (Django, Rails, Nest.js) but are all objectively inferior to the production languages

> As someone with a background in all of these scripting languages I don't think it's possible without some crazy mental gymnastics to not see how the production languages are clearly superior for almost all professional use cases.

What is even a "production language"? Lots of people are using Ruby, Python and Node in production, and it's working very well for them.

> I think the most likely case is people that think otherwise just have never tried them, at least not seriously enough to really grasp them.

That's a strawman.

You seem to have a very black/white view about production vs non production languages, that mostly maps to "used by classical big companies", and that doesn't seem to reflect reality very well.

Static compilation is great but all of those languages require you to jump through hoops or have significant caveats to statically compile programs. Go is the gold standard for static compilation, and it’s pretty great to be able to deploy a single file!
Java and C# are generally capable of this. It's a bit more native in Java than C# though. .NET has a rather awesome thing called the global assembly cache that makes static compilation somewhat of an anti-pattern.

For Java you can easily create a "fat jar" by dropping a plugin into your build system, usually with zero or minimal configuration. (shadow is the popular one for Gradle).

I am generally not a fan of Go (for a long list of reasons) but it's compilation speed and static by default (if you disable CGO, which you should) is definitely one of it's strong points.

I'm no Java developer, but JetBrains Java and PHP editors look very similar in functionality. And VS works fine with PHP.
There's something I don't like when people talk about PHP, and that's putting Symfony/Laravel and XAMP/shared hosting PHP into the same bucket. I feel like it's a dishonest way to present PHP as something it's not.

Symfony/Laravel PHP is basically like any other language, you could use Ruby with Rails, Python with Django, Java with Spring, Elixir with Phoenix and it's basically the same ballpark. But you give up the simplicity of setup and deployment.

XAMP PHP, on the other hand, is probably one of the most accessible way to do web programming, but isn't the same at all as Django, Rails or even Symfony/Laravel.

You use the same language, sure, but the two are very different beasts. You could probably add a third with the world of PHP-based CMS, like wordpress or drupal.

> Symfony/Laravel PHP is basically like any other language ... But you give up the simplicity of setup and deployment.

> XAMP PHP, on the other hand, is probably one of the most accessible way to do web programming, but isn't the same at all as Django, Rails or even Symfony/Laravel.

I'm confused by this assessment. As far as I understand, it is not unusual for hosting providers to offer shared hosting that supports php, but not other popular server-side languages, and makes it possible to run Symfony or Laravel, but not Django, Rails, Spring, or Phoenix.

My point is that if you're using Symfony/Laravel and composer, the difference between shared hosting or anything else that would run your python/ruby/java/elixir code is relatively small.
I don't care about the negativity around PHP (often from JS developers, which has its own quirks and pitfalls).

PHP is a language that gets stuff done, and if you're a good PHP developer, you can put together some beautiful code with a language that many people consider ugly.

I'm sticking with PHP for the foreseeable future. As far as my use cases are concerned, it's a brilliant tool for the job.

The first half of my career was heavy PHP and it helped make me into who I am today. I’ve barely touched it in the last 10 years, but the people who give PHP a hard time are largely misguided.

Last time I wrote about this it got some circulation so I’ll repost here.

https://www.brightball.com/articles/no-such-thing-as-real-pr...

PHP was my first language, but back in 2008 it was a real mess. Not only was performance based, but there wasn’t a package system if I recall correctly and everything was just in the standard library prelude namespace. The names were also really poorly standardized and optimized for keystrokes rather than readability. Security issues were abundant across the ecosystem, and everything ran slowly. Most importantly though, everything in the ecosystem intended for it to be used as a templating language like Jinja—little bits of PHP sprinkled amid a sea of HTML tags. I remember learning Java and Python and feeling so blown away because they weren’t doing this strange inside-out template programming—they would define webserver handlers and generally decouple the application logic from the HTML. I’m staunchly of the opinion that 2008 PHP was a hot mess, but also that not long before it was the easiest path toward a functional web application. I’m sure a lot has changed in the intervening years, especially considering Facebook’s heavy investment, but nevertheless I understand why it was so heavily criticized by people who used it back then.
Since this article is about when to upgrade depending on your language, I'd like to know if there is a place with information about languages/ecosystems by "longevity", which could be time before you have to upgrade your language, time before you have to upgrade your packages, or something like that. Of course this would be a complex measure. For example, having to upgrade the language AND change code would be worse than having to upgrade the language and don't change code. Same thing for dependencies.

For example, Go has strong backwards compatibility guarantees, but the last supported versions is less than a year old (1.16.9). PHP's security support of 7.3 ends in a bit more than a month, for a total of 3 years of support. Node.js is a bit younger but will still have 3 years of support. Java 8 still has extended support until 2030 by Oracle. There are also things like, with PHP, you may just have to change the environment, but with Go, you would have to recompile the code.

Maybe this could be better expressed as a "maintenance cost" or "churn"? I often hear that "ecosystem X has a lot of churn", but often it's not really well justified. For example, frontend JS moves a lot, but backend JS seem to have been "stuck" on Express for quite some time, and Express itself seems stable, if a bit dated. Maybe that's because we only hear about people changing code, frameworks, best practices? I don't see a lot of articles like "my 5 years old codebase is pretty much the same as when I began", compared to "I switched from X to Y".

Not exactly this, but we track EoL dates of almost every mainstream languages along with their release cycles (and compatibility guarantees, if any) at https://endoflife.date
That's actually what I used as a reference for a few parts of my comment, that's a nice coincidence. Since it's open source, I was wondering if a compare tool would be in the scope of the project?
We have an API, I think that’s something that should be doable with it.

Do create a discussion on GitHub though - would love to discuss this more.

I don't care what anyone says— I absolutely love PHP.

I automated my home theatre with it as seen here: https://www.youtube.com/watch?v=Cc8K6lg7Ag8

I built a website just for me so I can stream my movie collection anywhere I go, but it also has a button to start playing an automated show in my theatre.

I call it the Phantom. When you start a show, it plays a Dolby ad, a dancing hot dog-style vintage drive-in ad, and several random trailers in the same genre before the feature.

The Phantom PHP code controls the lights, projector, curtain, and sound system.

The lights come up for the credits and the whole room goes to sleep 30 minutes after the presentation.

I've only shared it once here before and someone, I'm guessing a PHP hater, gave it a thumbs down on YouTube.

PHP is extremely powerful in my experience and has been very lucrative in my career.

One of the best things I ever did was learn how to program with it.

Agreed. Ignore the haters. PHP is a silent giant that is hugely under-rated. While it is a perfect fit for the web, it is also an excellent general purpose scripting language for things that can traditional be done with bash.

PS. Sweet home theatre setup!

Thank you! Not ironically— another thumbs down. All some people have to offer this world is negativity. I feel sorry for them.
Also, HN removed it from the front page despite the upvotes. After, November 28 it may be more worthy
I've done a bit of PHP and it is not under-rated. Compared to most other languages it is terrible. Nobody is saying that you can't make cool stuff with it.

Try Typescript in your next project.

You literally made a personal home page with PHP, disproving your own point that it belongs in the industry.
I think there is nothing wrong with PHP if you are using it for what it was built for and you aren't pretending it's something it's not.

It's the people saying "PHP is the best language for building web apps in 2021" that are problematic.

No. It's simply not. We have come a long way since then and that view point can only be held out of ignorance.

That isn't to say you can't build awesome stuff in PHP, you can and in your case did.

But to say PHP > Java/C#/Rust/Elixir/etc is just being an edgelord for the sake of it. Language tech improved, PHP didn't come with it. That is fine, C didn't come with it either but it still has it's place.

Right tool right job, PHP can still be the right choice for lots of things if you have experience with it and can use it to make the thing you want.

PHP did evolve, and still is.
> It's the people saying "PHP is the best language for building web apps in 2021" that are problematic.

OP didn't say this.

> No. It's simply not. We have come a long way since then and that view point can only be held out of ignorance.

> Language tech improved, PHP didn't come with it.

Are you familiar with the changelogs over the past 10 years? Are you ignorant of the changelogs?

> But to say PHP > Java/C#/Rust/Elixir/etc is just being an edgelord for the sake of it.

OP isn't saying that.

> Right tool right job, PHP can still be the right choice for lots of things if you have experience with it and can use it to make the thing you want.

Isn't this true of any language?

I was agreeing with OP. You can use PHP, just don't be someone like you and it's fine.
Weird, I thought there was a resurgence of web app developers using React|VueJS on the frontend and Laravel (PHP framework) on the backend?
I'm not saying you're wrong or your point isn't valid, but I think it's subjective.

PHP developers are highly sought after in my fair Canadian city's web community. Not saying WordPress and PHP are ubiquitous, but the big players for web shops and even boutique agencies are using them.

It's my niche and one that's still lucrative, and since it's what industry needs and demands, it's what we teach at my workplace: a post-secondary college.

It may not be the best language or the best tool overall, but in my experience it almost always has been.

I don't think it's going anywhere anytime soon and it's constantly getting better, so I'm going to stick with my niche and keep turning to this really powerful tool.

I think you are correct. It sounds like PHP works well for the problems you solve.

I think it's similar to saying Python is the best choice for data science. It is. Not because it's a good language (it's not) but because due to factors like ecosystem it's the right tool for the job.

There is nothing wrong with embracing these local maximums.

I'm just tired of people asserting PHP is an -objectively- good/comparable language. Because it's not, for all of it's improvements it's still not close.

Is that ok? I think it is. Still solves problems effectively.

My "objectively inferior" language is Ruby. I use it all the time to do all sorts of things, little web servers, home automation, scripts on my desktop/laptop, etc. I like it, it works for me. Doesn't change the fact Ruby is flat out inferior to the languages I use at work.

> Language tech improved, PHP didn't come with it.

I'm curious what you are basing that on?

PHP is not a fixed language. 8.0 was just released last year and has significant improvements. And has had several minor releases since (latest one being just weeks ago).

It has a package manager, a community of OSS libraries, tooling... everything a mature language has.

According to Github in the last month:

> 36 authors have pushed 311 commits to master and 329 commits to all branches. On master, 413 files have changed and there have been 19,469 additions and 7,581 deletions.

Not including popular libraries like CakePHP, Laravel, Wordpress, Drupal, etc. All of which are also very active with hundreds (if not thousands for some) of contributors.

That doesn't seem stagnant to me.

Edit: As a note, I don't even use PHP anymore (though I used to a lot in the past). I'm just confused by how someone can say it hasn't evolved with the times. If anything PHP has proven time and time again it is in fact willing to involve. With releases that make leaps and bounds for performance (with benchmarks) and add new more "modern" features consistently for over a two decades.

I guess it depends on what your bar is. I'm comparing it against Java/C# primarily. If you compare it to Python then yeah, it looks like a pretty fast moving language, I just don't think that is a relevant comparison when your choices are much broader than just Python or PHP.

PHP 8 introduced a lot of great stuff but to me it's just about playing catch up to things like Kotlin, i.e null safe operator, etc. They made the runtime a lot faster with the JIT and the Opcache but it still pales in comparison to the JVM or CLR.

Type system is still not a real type system, it's more analogous to Typescript. I get why, it's because you can't turn around and make PHP backwards incompatible, but that is also why it can't ever be in the same class.

Meanwhile in JVM land you have things in progress like Loom which present a fundamental change in how highly concurrent applications can be built. Since Java 9 huge things landed like Jigsaw + ZGC and Shenandoah which are cutting edge GCs, not cutting edge for Java but in language-tech overall, i.e it's Java that sets the pace for what a modern VM looks like and that has been the case for some time now. v8 was perhaps more impressive for a short while until InvokeDynamic came along and escape analysis got better but these days JVM is pretty squarely in the lead with CLR closely following.

PHP won't ever be on the cutting edge and tbh, that is probably fine. Like I said, C isn't cutting edge and it's just as applicable as ever.

The difference between that and what people in this thread are arguing is they are saying things like "PHP is modern and generally good!" which just isn't true. It's improving and that is great, but modern and generally good it is not.

Doesn't stop it from being useful in the places it excels but as a general purpose language there are just better options.

I appreciate the detailed response to my question. But...

> as a general purpose language there are just better options

I don't think PHP ever pretends or tries to be a general purpose language or cutting edge. But I think to say it hasn't evolved is a bit misleading.

PHP has always been a domain specific language.

It is designed to do one thing well: stateless request oriented applications with strong ability to scale horizontally. And for that, it does pretty well.

Why did you go with PHP over another language? Do you have comparable experience with other languages to have had legitimate alternative options? Genuine question.

I'm deeply interested in your project as I have a similar goal. I would also like to create my own custom entertainment setup, throwing in commercials/trailers with feature presentations. Do you have a website or place I can reach out to you with questions?

Or for Hacker News readers, if I want to create a similar custom media playlist kind of thing, is it possible to do that with VLC or would I have to write a custom solution?

I've dabbled a bit in C/C++, and even a little Python, but not enough to build something like this.

Maybe one day I'd like to re-write it with everything I've learnt so I can compile it and monetize it.

I've also thought about open sourcing it, but the code is a little rough (messy) as-is and I struggle with what to do.

I know JavaScript and PHP, and PHP just seemed to do everything I needed.

I built a website a long time ago for collaborative music composition. It interacted with command line software and used XMPP to communicate with the server.

That sorta lead to using PHP to control everything in the theatre, plus a lot of the components I bought can be controlled through HTTP commands.

Overall, this was a side-project and I've slowly perfected the timing and the features over the past six years to where I have it pretty feature complete and reliable now.

Everything is timed perfectly, it can handle intermissions, overtures, and exit music. If there's some sort of break down, it shows film melting, shuts off the projector, and brings the lights up... Stuff like that.

As for VLC: This all runs on a Raspberry Pi 4. I originally used VLC but started having trouble with it when I moved from the Odroid XU4 to the Pi, so now it runs on mpv.

Moved to the Pi because I wanted to run Netflix in the theatre easily as well. If the Odroid ran Netflix (and some other small things), I'd prefer it.

For my part, I learned PHP because a lot of small web-shops were using it, and I wanted a job in a small web-shop. Previously I had coded professionally in COBOL, C, VB6, and Java, and I knew Forth.

I made money writing PHP for a decade-and-a-half. Straight PHP is not particularly lucrative work; but Drupal module development can pay quite well.

For the "custom media playlist": VLC is just a player. But there's a player built-into your browser; my home-brew playlist originally used VLC, but I switched to using the <video> tag once it became reliable (and would play ogg/vorbis properly). You still need a backend; and you'll probably need quite a bit of Javascript.

> But there's a player built-into your browser; my home-brew playlist originally used VLC, but I switched to using the <video> tag once it became reliable (and would play ogg/vorbis properly).

Interesting. To use a very high level example, would something like the following work? Have a backend generate a webpage with a video from local storage playing via <video> tags, then refresh with javascript and have a different video playing?

Absolutely - that's exactly what I do. I have a playlist manager, navigation and so on. You can use a mouse, but it's designed for keyboard operation; there's a lot of hotkeys.

Hang on - you said "from local storage". The video is played from server-side storage. If it was on local storage on the client, you could only play it on that client. So I take it you meant "local to the server", in contrast to online video resources.

> Hang on - you said "from local storage". The video is played from server-side storage. If it was on local storage on the client, you could only play it on that client. So I take it you meant "local to the server", in contrast to online video resources.

Bingo. In switching over to pet project thought mode I started thinking "local to myself" rather than the usual client-server wording.

Thanks for the advice! That sounds genius. I can much more easily imagine implementing this with my existing skills compared to figuring out how to script VLC or some other media player.

Now I'm guessing this approach serves the server media file to the client browser, and the client browser then plays it locally. Would it be possible to create a kind of TV-channel/radio-station type of approach where the server is constantly playing a video, and any client on the network can hop onto the stream like a TV channel?

The <video> tag also has a javascript model you have to learn, like with VLC. It gets video in junks, on request from the browser; if nobody's requesting chunks, no chunks will be played. You can't play if there's nobody listening. It doesn't serve files. If you start a new item, it begins to play immediately - it doesn't seem to need to buffer.

I imagine your media channel thing can be done, but I haven't tried it or thought about it. Not my use-case!

It's not "genius", BTW - I'm no media expert, not even a very good programmer. I'm just a tinkerer with an itch to scratch. And there's no way I'm sharing my code - it's a pile of crap, permanent work-in-progress.

I like the <video> tag very much, because it's cross-browser, and (IMO) is easier to script than previous players.

I also like PHP. It is also an awful language, though, and always has been. Inconsistent parameter ordering, the infamous NULL/0/""/FALSE heffalump trap, object-orientation as an afterthought. Many more. It's OK once you know the language well, but a lot of PHP developers don't.

I have a PHP app written in PHP5.6, for my own use (not exposed on the internet). Naturally it broke when I upgraded to Debian Buster. Upgrading the code would have taken ages; but it took me just a day or so to work out how to get PHP5.6 working on Buster.

I've retired, because I can, and because I prefer not to work if I don't have to. There's a pretty steep learning curve from PHP5 to PHP8; I don't want to do that learning, if it's no longer necessary for my job, and I'm only using it for a private app.

I've not used PHP8 on anything serious, but my impression is that it's a HUGE improvement on PHP5. It's a lot more coherent, a lot faster, and a lot more secure. A lot of what has been dropped was dropped because it was insecure crap - it had to go sooner or later. In the end it was "better late than never".

I think PHP7+ has provided a lot in terms of modernization and focus on the OO paradigm.

For what it's worth, there are a couple of tools out there that should help getting your personal app up and running on PHP7 if you're interested in doing that at some point. Most of the breaking changes I've run into are because deprecated features were removed, which in a lot of cases seemed like strange/wrong syntax to me anyway.

I have a legacy app that can't feasibly be updated past 5.6 because it uses a totally undocumented framework that wasn't built in-house. While I could run one of the tools I mentioned, 99% of the framework code probably never runs so there would be a lot of work done for nothing.

PHP is one of the easiest language to install on Apache and later web servers. It is also a no brainer to install software written in PHP on those servers. It is a wonder why other language implementors haven't looked at doing the same thing.
Because it’s out of the language implementors’ hands. Support in Apache, for example, requires Apache to be compiled with certain configuration, so if big Apache distributors don’t compile with support to your language, there’s nothing a language implementor can do to help. It’s like asking why Ruby doesn’t work harder to make itself included by Windows—I’m pretty sure the maintainers wouldn’t object, but they don’t have a say on that anyway.
That's not quite right. The PHP implementation doesn't require Apache to do anything special for them. Apache had modules and other servers had things like FastCGI.
I usually work with Go, and it seems a lot nicer just to let it listen on a socket perhaps with Nginx in front of it. Having to install a guest application onto a webserver program has always seemed silly to me.
PHP is widely used because it is easy to use. In contrast with other programming languages that are complex, PHP is simple, fluent, clean and organized, hence it is a boon for the new users. PHP has a well-organized syntax which is logical at the same time
What does it say about things when about an hour after the article is posted we have two thread discussing the upgrade question that is central to the article, one drawing attention to the limitations of the methodology, and like five evangelizing with words like “I don’t care what the haters think, I love PHP?”

As of writing, at least, no one here is attacking your language.

lol 78% of total URLs, including parked domains on camper sites. So you have to count a parked domain page the same weight as youtube.com to get to 78%
And yet, Slack, Etsy, Wikipedia, WordPress, Mailchimp, Canva, Indeed, Investing.com are using PHP. I would think Wikipedia is a worthy competitor to youtube in this regard.
PHP wins because you can write a few lines of code in single file, shit it into an apache folder, and you have a fully functional front and backend of a web app. There is no other web framework / language that is easier to get started with.

I've always had this dream of writing something like "PyHP" which was the same thing, except you put python files into an nginx folder and anything sent to stdout is sent to the browser, but I've never gotten around to it. Would love if someone made this.

>I've always had this dream of writing something like "PyHP"

Similar here, Something Ruby-PHP. But even PyHP will do for me.

I think the problem is PHP was designed by someone who just want to get shit done and absolutely dreaded programming. Versus programmers who just wanted to create a beautiful programming language.

I was able to do this with erb (ruby templating language) very similarly to php scripts eons ago. It just never caught on to do it that way for other languages because php already had that market sewn up.

This isn't disagreeing with you, just saying that it is this way for cultural rather than technical reasons.

They made it a long time ago. It's called CGI [1].

Seriously, there's no inherent PHP advantage so you have to build something new. It is only that Apache package maintainers started shipping a mod_php package that required almost zero configuration to get up and running. Then every other web server followed suit.

On the other hand, alternatives for other languages were either slow (i.e. CGI-based) or harder to configure (e.g. mod_python [2]).

[1] https://docs.python.org/3/library/cgi.html [2] http://modpython.org/

I suspect the success of PHP is binded to the success of BBOM architecture (http://www.laputan.org/mud/)
I counter that PHP could have been bigger if it wasn't because of all the BBOM stuff. I'm sure it scared away the OG devs in those days, thinking PHP wasnt worth their time.
No tooling needed to deploy code is a massive contributing factor to PHP success.

It's maddening what's needed to deploy code for other web languages.

Most good languages are self-hosting with little/no dependencies.

Where you run into trouble is the scripting languages, i.e Node.js/Ruby/Python. You are best off avoiding these if don't like deployment nightmares.

PHP is in my opinion the best solution when creating libre open-source software

It gives the widest amount of people the chance to selfhost for cheap.

You can get a PHP webhost for $5 per month including databases, some cheaper, some more expensive.

You dont have to worry about a VPS, Docker, Kubernetes, or anything like that. Hosting companies contribute by having "one click installs"

Sign up, pay you bill, click a button and you have your very own Wordpress instance and you can publish what you want.

If you create solutions that you want people to be able to self-host it is the best choice for now.

It is far from perfect.

WP has suffered a long string of severe security bugs. People have gotten their sites hacked

Some cheap hosters are not good. (I had great experience with a couple)

A lot of devs like to hate PHP and see it something awful from two decades ago. I understand that. There is truth in it. PHP from 20 years ago is quite different from PHP now. It is probably better than you think.

I would not start a project that needs to Google scale on PHP.

Nor would I expect a lot of people to have the ability to cheaply and easily self-host something like that.

but I like running my own Wordpress, my own file share solution, my own wiki and so on.

I can do all that dirt cheap thanks to awesome developers, PHP and cheap hosting.

Yet HN removed from the front page. Why the hate for PHP.
Security consultant who audits web applications. I’ve achieved many web shells over the years, the majority (80%) were in php. I’ve never seen an exploitable sql injection vector in anything but php.

When I make recommendations, they’re generally level headed somewhere between fix this, fix all instances of this, or just start from scratch. Php often receives the latter, and not purely on its language merits alone - my last php report was 150 pages due to frameworkless insanity resulting in vulnerabilities in almost every facet of the system (I literally got all top 10 owasp in a single app).

I don’t know what it is about php, maybe it’s the low bar to entry or lack of unit tests, but something about the languages just results in vulnerable code.

Jeez, people, it's right there in the opening line.

> ... whose server-side programming language we know

How many of all the websites advertise their server language accurately? Everything else I've used in the past decade does not.

This seems to pop up on HN on a regular basis. I'm no fan of PHP (I've done my time thanks) but while I can't deny the popularity, these posts speak more to its users' insecurity than anything else.

In short: who cares? But judging by the comments, far too many people.

PHP == “The COBOL of the web”