News for hackers. Stuff that matters.
Re:PHP Sadness by skrebbel on Thursday November 29, 2018 @07:10AM (#18559615)
Not to take anything away from this post because PHP is a mess, but yesterday I dragged and dropped some PHP files onto a server with FileZilla, opened the right URL in a browser and it worked. No bundler, no docker, no kubernetes.

That was some PHP Happiness right there.

Re:PHP Sadness by kijin on Thursday November 29, 2018 @07:29AM (#18559701)
I also like the single-threaded, shared-nothing architecture that PHP inherited straight from the CGI days. Every request is guaranteed to start in a clean state. It's amazing that PHP 7 is as fast as it is even while sticking to the execution model of a shell script.

I wish I could run Python or JavaScript this way without losing too much performance.

Re:PHP Sadness by skrebbel on Thursday November 29, 2018 @08:16AM (#18559928)
Yeah me too! Essentially PHP is a purely functional programming language in the Rich Hickey sense ("If a tree falls in the woods, does it make a sound? If a pure function mutates some local data in order to produce an immutable return value, is that ok?").

PHP is like React on the server side, since the HTML output is a pure function of the request (and external state in eg a database of course). I like to think that it's no wonder that React got invented in a company totally built on PHP. Someone must've complained "I just want to change the URL and rerender the entire page with every user action, not mess around in jQuery". Someone else said "But that won't be fast enough!" and then someone must've gone "Hmm, but couldn't we make it fast enough?"

Re:PHP Sadness by dsego on Thursday November 29, 2018 @04:08PM (#18564031)
Actually, the story about PHP inspiring React is totally correct, at least I remember reading it somewhere when React just came out. Also Composer inspired Yarn, the NPM alternative.
Re:PHP Sadness by symlinkedtonull on Thursday November 29, 2018 @05:21PM (#18564691)
Regardless of PHP's warts, Composer is definitely something worth emulating.
Re:PHP Sadness by solarkraft on Thursday November 29, 2018 @10:05AM (#18560664)
One might argue that React is clunky (but I completely get the benefits).
Re:PHP Sadness by skrebbel on Thursday November 29, 2018 @01:22PM (#18562425)
Whereas PHP is a beacon of elegance? :-)
Re:PHP Sadness by open-source-ux on Thursday November 29, 2018 @09:06AM (#18560194)
It's almost 2019 and it's pretty amazing that no other language among the dozens available for web development feature easy server-side deployment.

It's frustrating and baffling for anyone who wants to provide users with an easy way to self-install or self-host.

Easy server deployment of apps simply doesn't exist (unless you're Wordpress with one-click installs available everywhere). Many developers consider easy deployment a non-issue.

Here's a previous question I asked on the topic:

https://news.ycombinator.com/item?id=14781420

Re:PHP Sadness by evilduck on Thursday November 29, 2018 @12:17PM (#18561815)
There are other languages that can behave like this, Ruby ERB templates are one that can be done the same way. You can't just drag and drop PHP without some initial server side configuration either.

The reason it's nearly 2019 and no other language does this is because it's a really terrible way to manage software deployment.

Re:PHP Sadness by josteink on Thursday November 29, 2018 @05:09PM (#18564589)
> The reason it's nearly 2019 and no other language does this is because it's a really terrible way to manage software deployment.

I’m not a fan of PHP (the platform), but that sure sounds more like an opinion than an objective truth.

Could you outline some objective reasons why simply copying the code you want to run to the server you want to run it on is a bad deployment model?

Re:PHP Sadness by CM30 on Thursday November 29, 2018 @03:01PM (#18563411)
Yeah, and that simplicity is also why systems like WordPress, Drupal, etc aren't going anywhere any time soon either. Yes they require an install process and a database setup, but compared to their newer competitors like Ghost, that's a lot more viable for someone with little computer experience than figuring out the command line or what not.

Like it or not, PHP and many applications written in it are more user friendly than many of their alternatives, which is worth a lot more to average Joes than security or code quality.

Re:PHP Sadness by theamk on Thursday November 29, 2018 @01:14PM (#18562354)
Unfortunately, the ease of deployment often means lower security. Lots of popular packages expect regular web user to be able to update source code (!), totally defeating any protection OS may provide: https://www.drupal.org/docs/7/install/step-4-run-the-install...

PHP is really nice and easy to deploy, and it would be my first choice for trivial one-file scripts, but I wish people did not use those simple deploy methods on the big internet. The net is not a nice place it used to be 10 years ago, and today, deploying scripts without any OS-based security protection is just irresponsible.

(And yes, it is possible to deploy PHP in the secure way with proper privilege separation, but most of the large, existing projects recommend doing it insecurely)

Re:PHP Sadness by code_duck on Thursday November 29, 2018 @12:47PM (#18562069)
I agree, I don’t hesitate to use PHP for quick tasks like that. But would I try to write serious software in it? Definitely not.
Re:PHP Sadness by GrumpyNl on Thursday November 29, 2018 @07:29AM (#18559702)
Thats how i work to and i love it.
Re:PHP Sadness by newaccoutnas on Thursday November 29, 2018 @07:31AM (#18559715)
Well you could say that for anything that doesn't a) Require 'compose' (as you say, no bundler) - so no dependency management (not ideal) or your code is so minimal it doesn't need any, which isn't the case for large projects b) Require any infrastructure that's hosting the PHP app needing to be configured in the first place. That was conveniently overlooked. i.e. You don't even need to SFTP any files with something like Heroku or PaaS. It's an apples and oranges comparison imho