News for hackers. Stuff that matters.
Re:PHP in 2024 by gopalv on Wednesday April 10, 2024 @02:59AM (#39987761)
PHP has a special place in the story of the web-dev.

The whole "no build step" was the most underrated factor for its success, because it was such a low-skill tool to pick up.

The tightness of that edit-test-move loop was why I used it, even if the "edit" included "sftp it to a vhost".

That bit is what made it successful & I can't think of anything I've used in the last decade which felt as easy as PHP for that particular style of self-taught programmer.

Re:PHP in 2024 by yashg on Wednesday April 10, 2024 @03:57AM (#39988134)
Back in the day when VS Code didn't exist and even sftp was rare and the world ran on port 21 classic FTP, we had code editors with built in FTP like PHPEdit, we would literally hit Ctrl+S and save and upload the file on production in one stroke. Refresh the page in browser on the live site and there it is. Those were the insane days before terms like agile and CI/CD were even invented.
Re:PHP in 2024 by progx on Wednesday April 10, 2024 @04:07AM (#39988189)
Yes insane and after upload "bang error", sh...t, fast fix the error and upload it quick again, befor anybody register the error :D :D
Re:PHP in 2024 by aaviator42 on Wednesday April 10, 2024 @05:37AM (#39988757)
Ctrl-Z, Ctrl-Z, Ctrl-Z, Ctrl-S!
Re:PHP in 2024 by throwaway11460 on Wednesday April 10, 2024 @04:10AM (#39988208)
Scrum is older than Linux.
Re:PHP in 2024 by aaviator42 on Wednesday April 10, 2024 @05:38AM (#39988761)
I still do this! Often still over FTP, sometimes over folder mounted over SSH.
Re:PHP in 2024 by pjerem on Wednesday April 10, 2024 @03:35AM (#39987980)
I didn’t touch PHP for a long time but it have a nice place in my heart especially for the reasons you gave.

I have a hard time with people joking about PHP because while it wasn’t perfect back in the day, it’s probably the culminating point of the non elitist computing. PHP was accessible to anyone who had the basics of creating an HTML website (which was a skill any random person could acquire in a day or two).

Also, the people making those jokes are most of the time working on projects with micro services and SPAs everywhere for a boring business app with CRUD and forms. Which I find pretty ironic since a single PHP monolith solved this exact use case 20 years ago.

Re:PHP in 2024 by kaba0 on Wednesday April 10, 2024 @05:58AM (#39988890)
Also, it had dirt-cheap hosting, as a single process could host multiple sites (though it did come with some security implications).

Nowadays we tend to bring up a whole virtual OS.

An interesting direction in this area might be GraalOS, which might allow running multiple applications in a single OS process, doing the necessary isolation itself. (Not affiliated)

Re:PHP in 2024 by supernes on Wednesday April 10, 2024 @03:29AM (#39987946)
Hot Module Replacement and Live Reload in Node-based web dev servers bring some of that magic feeling back, although you will quickly need to learn about module resolution and other intricacies.
Re:PHP in 2024 by jopsen on Wednesday April 10, 2024 @03:49AM (#39988084)
The criticism is that those things comes with mountains of complexity.
Re:PHP in 2024 by progx on Wednesday April 10, 2024 @04:05AM (#39988180)
That is the problem of the tool developers not of the app developers. For us, it is easy to use.
Re:PHP in 2024 by kaba0 on Wednesday April 10, 2024 @06:00AM (#39988906)
It also breaks easily. Npm is a very unstable platform.
Re:PHP in 2024 by Morelesshell on Wednesday April 10, 2024 @04:06AM (#39988184)
This also lead to shitty tool integration.

While it was always easy to debug java based apps and the debug support is great (remote connection, drop frames, all types of breakpoints etc.) people struggled with this in php.

I showed a professional a few years back how to debug with php, after 2 weeks he stoped using it...

Re:PHP in 2024 by kijin on Wednesday April 10, 2024 @03:59AM (#39988143)
I'm taking the "no build step" thing to the extreme in one of my projects.

PHP has libraries for compiling SCSS and minifying JS, and filemtime() is very fast. So if you wire them together in just the right way, you can edit any script or stylesheet under the project hierarchy and have them compiled, minified, and bundled together on the fly. Cache the bundle until you edit one of them files again, and automatically bust the cache once you do.

No need to build anything whatsoever, both on the frontend and on the backend. It's like REPL over HTTP.

Re:PHP in 2024 by todotask on Wednesday April 10, 2024 @04:52AM (#39988459)
> PHP has libraries for compiling SCSS and minifying JS, and filemtime() is very fast

If you do compiling and minifying, that's a build step.

Re:PHP in 2024 by wildrhythms on Wednesday April 10, 2024 @05:54AM (#39988860)
The usage of the term 'step' here is in the pre-deployment development process sense. I think what this person is doing is converting SCSS to CSS on request, at runtime.
Re:PHP in 2024 by todotask on Wednesday April 10, 2024 @06:39AM (#39989162)
Regardless of which steo, compilation process is typically done as part of a build step, where the SCSS files are transformed into the final CSS that will be served as a bundle to the end users' application.

Web browsers can't understand SCSS natively.

To be truly extreme (performance), devs should consider tree-shaking unused CSS and JavaScript. This may require using Vite (Rolldown is in the works/Rollup) if there are no other options or it makes no sense to serve bloated resources. That's the reason, I chose Astro as I care about users, not prioritse the developers' minimalistic workflows.

I prefer Tailwind because it allows me to avoid duplicating classes (mine and vendors), which is an advantage over other approaches.

I did dogfooding in Go development.

Re:PHP in 2024 by kijin on Wednesday April 10, 2024 @07:36AM (#39989523)
Every human-readable programming language needs to be compiled into some sort of bytecode (opcode in PHP) and/or machine language in order to work. The question is whether a human ever needs to be aware of that step. In PHP, you generally don't. In the aforementioned setup, you don't need to be aware of SCSS compilation and minification, either. Not even if you use devtools, because the map file will point to the correct line in the original source.
Re:PHP in 2024 by hu3 on Thursday April 11, 2024 @08:46PM (#40008330)
I can confirm, this approach works great!

I use this in production for a system with 3k requests per second that runs in a single Apache+PHP web server and a single 80GB MySQL database. Never needed to optimize anything.

You have no idea how happy it makes me to see someone else was bold enough to try this and it worked for them too.

Simple, maintainable, instant SCSS and JS build pipelines with all the benefits and no drawbacks! Plus any junior can understand and change it in minutes.

Re:PHP in 2024 by cabirum on Wednesday April 10, 2024 @03:35AM (#39987973)
It's only easy to start up to hello world kind of projects.

To build anything useful you quickly discover that it's hard to build from source (both the lang and extensions), some parts unmaintained for years. There are many counterintuitive idiosyncrasies you must deal with to be productive. The ecosystem suffers from the overuse of indirection and reflection. Php only looks easy, but the rabbits hole goes deeper than most other langs.

Re:PHP in 2024 by deergomoo on Wednesday April 10, 2024 @03:44AM (#39988055)
Why on earth would you need to build PHP or its extensions from source to build a useful web project?
Re:PHP in 2024 by pjerem on Wednesday April 10, 2024 @03:44AM (#39988058)
> It's only easy to start up to hello world kind of projects.

Sure but the important part here is it’s also easy to deploy to the internet for free or a few bucks.

All you said is right but still, I don’t think there is anything comparable nowadays and if I had to explain to my son how to create a basic non static website without using proprietary PaaS, I’d have a hard time (without PHP).

Was it the best option when you were a company building a product ? idk but at least it was a viable option. Was it the best option for any kiddo wanting to learn creating things on the internet ? Totally and we never got anything better for this since PHP.

Re:PHP in 2024 by gog on Wednesday April 10, 2024 @03:38AM (#39987996)
How would you describe something useful?

Can you give examples of counterintuitive idiosyncrasies you must deal with to be productive?

Re:PHP in 2024 by M95D on Wednesday April 10, 2024 @06:58AM (#39989289)
I liked the documentation. The old documentation, in a .chm file.