Hacker News new | ask | show | jobs
by alvis 2038 days ago
Same as many web languages, PHP's heyday has a reason as many toolkits at that time were far less powerful and complicated for even simple things. Perl+CGI + all the server setup for a simple dynamic page? It's just unimaginable to many today's developer.

I started off with PHP3 and have a very great and hated time with it till v5. PHP for sure is difficult to maintain and very painful to debug, but it's not my reason leaving it. It's because JS began to pick up and started to do many tasks that requires no server rendering. The server sides started to become just API server, which no longer generate html on the fly. It's much scalable and easy to maintain.

Time flies, now I see the release of PHP 8 and I realise I have ditched it for a decade. Do I miss you? No.

1 comments

> Perl+CGI + all the server setup for a simple dynamic page? It's just unimaginable to many today's developer.

TBH, I'm still not aware of any truly simple/easy way to get a dynamic HTML page.

Recently, I had to make a dumb utility app to render some dynamic data, and I wound up writing a Golang server with the HTML specified as a Go Template. But making it accessible on the publc internet still required spinning up a server, installing nginx, configuring SSL with Let's Encrypt (at least it was free) and futzing around with nginx `proxypass` directives for several hours.

It works, and I guess it's conceptually simple, but it was still an all-day ordeal to get it up and running from scratch.

That’s PHP’s wheelhouse.

If you don’t want to just use some shared hosting, grab any server and use the package manager to install Apache + PHP.

Drop HTML in the web root.

Whatever part of the page is supposed to be dynamic, you can literally just start throwing code in the middle of the HTML, mixing it all together freely.

It won’t be beautiful, but you can go from nothing to this in like 30 minutes or an hour.

Have you tried Caddy as your reverse proxy? It's much simpler compared to nginx and it has very robust, integrated LE support. It's also packaged for Debian and CentOS now.

Write a systemd unit file for your golang service, put Caddy in front of it and you are good to go. It's not a PaaS, but it's simple and shouldn't be too difficult to maintain.

> Write a systemd unit file for your golang service

Oh yeah, I forgot I had to do that, too! Another step.

I'll take a look at Caddy!

But now you know it. I do all that stuff for all my personal projects, but it is much faster because I already have servers and I have done it a couple dozen times now. I'm getting to know proxypass and caching directives very well. My first time took hours and much futzing. Once it becomes routine, I automate. I wrote my own build server in JS and bash, it handles webhooks, roll-back on fail and notifications. I've been meaning to mess with ansible.

It has even come in handy at work. I'm primarily a front-ender, but a start up I worked for had me continuously deploy my application to my own personal infra so it could be used immediately.

It is an ordeal at first, but nginx is so darn powerful it makes me feel like a wizard. If you want to avoid the arcane incantations, I'm sure Caddy would be a simpler option.

Azure Static Web Apps and then a bit of AJAX to pull in the data from a function (all deployed automatically in one go)

https://azure.microsoft.com/en-us/services/app-service/stati...

Not a dynamic HTML page per-se but a page with dynamic data.

I deployed one of my old hackathon apps with it, works well - https://memorylane.benbristow.co.uk/