10 ms·
The demise of the mildly dynamic website (2022)
- brendadavis22 2y agoI've been struggling with how to hack someones WhatsApp messages without touching their cell phone for almost a year. I've tried at least 10 different apps and none of them worked. I found shadownethacker44@gmail.com after reading a blog post on how to hack someones WhatsApp messages without touching their cell phone and the reviews were all good so I thought I would give it a try
- politelemon 2y ago> What captured people's imaginations about AWS Lambda is that it lets you a) give any piece of code an URL, and b) that code doesn't consume resources when it's not being used. Yet these are also exactly the attributes possessed by PHP or CGI scripts. In fact, it's far easier for me to write a PHP script and rsync it to a web server of mine than for me to figure out the extensive and complex tooling for creating, maintaining and deploying AWS Lambda functions — and it comes without the lock-in to boot. Moreover, the former allows me to give an URL to a piece of code instantly, whereas with the latter I have to figure out how to setup AWS API Gateway plumbing correctly. I'm genuinely curious how many people find AWS Lambda interesting because they've never encountered, or never properly looked at, CGI. Well, assuming you are genuinely curious and not just using an expression! The difference is that the 'web server' is still consuming resources when the code is not in use. They aren't equivalent at all. The web server is hosted on an OS and both require ongoing maintenance. Further, the appeal of Lambda is in its ease of onboarding for newcomers; I can run a piece of .NET or JS or Python locally and directly without a lambda 'layer' to host it, just invoke the handler method. I'm not sure what complex tooling that the author is referring to though, it's a zip and push.
- icedchai 2y agoOnce you add API gateway, IAM roles/permissions, VPC, security groups, it gets a lot more complicated. Then you want to host a static web site, reverse proxying to API gateway, add CloudFront, WAF, etc. You'll go crazy setting this up manually, so you'll also want Terraform or CloudFormation to make it repeatable. For anything complex, you'll run into "slow start" issues and have to look at provisioned concurrency. Lambda also sucks for dependencies. Zips and "layers" can only be so large. Eventually you'll hit the limit and have to move to containers. There are also other limitations, like payload sizes. Eventually you might run into that, too. Also, it would be nice if Lambda just reused the CGI interface instead of inventing its own thing.
- owenversteeg 2y agoYeah, it's an absolute explosion of complexity, and with it comes the risk that you miss something and are faced with a security issue or giant bill or both. What I would kill for is something in between all of this and FTPing PHP around like it's 1999. I've hunted for years for middle-ground solutions and haven't found anything. Security, cost, performance etc are important, sure, but what I really yearn for is a simple, easy, bulletproof solution like the days of yore when a handful of simple scripts could chug on for decades. Two decades ago you could set up a simple site that needed no attention for twenty years. Today's technologies require constant attention and updates and if you blink then everything requires an update that's not compatible with your code. Meanwhile, PHP from 2004 can be trivially run in 2024. What's the PHP-and-FTP of today? Does it exist?
- denton-scratch 2y ago> Two decades ago you could set up a simple site that needed no attention for twenty years. ...but as of yesterday, you can't?
- twobitshifter 2y agoHave you seen https://www.val.town/ https://www.val.town/ ?
- llm_trw 2y agoIt's still php-and-ftp. Sometimes I get fancy and use python and ssh.
- icedchai 2y agoI was going to say the same thing. I generally use Laravel instead of "raw" PHP these days, but still...
- ArneBab 2y agoI nowadays mostly use a simple static website plus minimal Javascript, but I still have PHP sites. It still works. And PHP today is at least factor 3 faster than PHP was back then — on the same hardware. So maybe just use PHP and ftps or sftp?
- chasd00 2y agoIn a lot of these discussions the point gets raised about the work to maintain a self-hosted server. When i've done it I install the os (usually ubuntu server), turn off unused services, setup the firewall to only allow required ports, and then it just sort of sits there and does its thing. Uptimes have been measured in years in some cases and the server just sits there happily serving whatever html and connecting to whatever db forever.
- pixl97 2y agoI mean, typically hosting a static site that's fine, but with the number of exploits these days and the ability for people to chain them together, maybe you don't even realize your box has been exploited? Uptimes in years means your box, especially without updates has something it could be targeted with.
- graemep 2y agoMost of those that are find for a static site but not dynamic are those that are not fixed by just applying updates from the distro. You still need to update your app code even if you are using someone elses servers, so its the same either way.
- pixl97 2y agoNote that the parent said "uptimes measured in years", so they are either using a more complex system with multiple servers, or they are not doing security updates.
- graemep 2y agoI agree I would not endorse uptimes measures in years, which means not doing kernel updates - but OP does qualify that with "in some cases".
- josephcsible 2y agoDo you enable unattended upgrades and kernel live patching? If not, then that doesn't seem secure.
- jacobgkau 2y ago> They aren't equivalent at all. The web server is hosted on an OS and both require ongoing maintenance. From a technical standpoint, surely the servers running Lambda have an OS and require maintenance internally by Amazon at some level (even if it's dev-ops-abstracted away for their operators). It's just their responsibility instead of yours, and it's also their responsibility to find other work for those servers when your code isn't running (or bear the cost of an idle server). It's like if they were letting you push PHP functions to their web server, using the quoted comparison. Useful from a business standpoint, yes. Revolutionary, maybe not as much as it seems at first glance. That's the takeaway I got.
- Joker_vD 2y agoAnd, of course, they don't just "bear the cost of an idle server". Just like any other fixed costs in any other industry, those costs get smeared over the charged prices. Unless there is some serious economy of scale (i.e. ops at Amazon managing to handle the upkeep of a 1000 of their servers for less than 1/1000 it costs you to manage 1 of your server), you're ending up paying somewhat more. But then again, you don't have to spend time to manage your own server which is probably a positive trade-off.
- lompad 2y ago>> somewhat It's a factor of 5 to 20 [1] in many cases. Regular hosting is unbelievably cheap, especially in high traffic environments. [1] https://tech.ahrefs.com/how-ahrefs-saved-us-400m-in-3-years-by-not-going-to-the-cloud-8939dd930af8 https://tech.ahrefs.com/how-ahrefs-saved-us-400m-in-3-years-...
- Uehreka 2y ago> Useful from a business standpoint, yes. This business standpoint is the whole thing, I don’t see many people arguing otherwise. And the business standpoint is in fact quite revolutionary. Amazon can have a team of like 5 engineers maintaining VM images and as a result 500,000 other people don’t have to. And so you can host a “server” that’s only “on” when it’s in use, and usually end up paying less than $1/mo. In fact, you could likely run all of your side projects in lambda and if they’re “conventional web server” type things you could still end up paying less than $1/mo across all of them. Compare that to a $5/mo droplet for every side project (you probably don’t want to bunk multiple services into a $5 VM) and it definitely adds up before even considering updating the OS on those droplets.
- Sharlin 2y agoRunning PHP on a VM in a data center doesn’t cost you anything either while the VM isn’t doing stuff, and you still have something to ssh into and manage and investigate without layers of abstraction bolted on top. And PHP-on-httpd is pretty much one of the most newcomer-friendly straight-to-coding environments ever developed.
- sophacles 2y agoWhere can I get a VM in a data center that doesn't cost me anything?
- theendisney 2y agocost and convenience: Time is money. Whatever works for you is more important than 5 euro.
- rty32 2y agoLambda is pretty straightforward as well for those who know how to use it. You probably could do something marginally useful with lambda within 30 seconds as well.
- ArneBab 2y agoDon’t you have a virtual server? I’m pretty sure that my managed webserver runs on some virtual machine somewhere on a bigger server, and when it is not doing stuff, other tasks are running there and using the CPU and bandwidth. There is likely some fixed memory and disk space cost, but those are negligible with todays capacities.
- superkuh 2y agoServer side includes are still the perfect amount of power if you want to do templating stuff like comments.html footer.html or right_menu.html includes across all site pages. And the attack surface is so minimal and code so stable there's basically no increased risk using SSI over just html with nginx and similar webservers.
- bandrami 2y agoAh but! The problem is SSI includes the bang directive, which outputs the results of a shell command. Once that's available, people will demand and abuse it, and we're back at cgi-bin.
- superkuh 2y ago> SSI includes the bang directive, Not in ngx_http_ssi_module or any modern webserver I've used? As for "people"? What people? I guess your implicit assumption is this is a group or commercial project? I was thinking more website made by a human person.
- bandrami 2y agohttps://httpd.apache.org/docs/current/howto/ssi.html https://httpd.apache.org/docs/current/howto/ssi.html (I've still never seen the need to switch to more trendy web servers, so they may well have disabled exec)
- RedShift1 2y agoBut can you write Doom with SSI?
- doublerabbit 2y agoI suppose in theory. Pass the button press of the clicked button iframe to a headless version of the game. Capture and transfer the output to an transparent png back via an http meta refresh in another iframe.
- flobosg 2y ago(2022)
- dang 2y agoAdded. Thanks!
- deleted 2y ago[deleted]
- dang 2y agoDiscussed at the time: The Demise of the Mildly Dynamic Website - https://news.ycombinator.com/item?id=31236290 https://news.ycombinator.com/item?id=31236290 - May 2022 (91 comments)
- rkozik1989 2y agoDid everyone just forget about Varnish HTTP Cache or something? Or are we just using the new shiny ball because its new?
- snovymgodym 2y agoI like this article except for the part about Lambda. The author doesn't seem to get that for some use cases there are serious benefits to having bits of code that run only when you need it, and only getting billed for those runs instead of getting billed for a VM or container runtime that's always present. Obviously if your application involves processing a predictable high volume of requests, then you're probably better off running it on your own server/container, but depending on your use case there are times where Functions-as-a-service are the prefect solution. The part about "why use lambda when cgi-bin exists" reminds me of the HN comment on the DropBox announcement from 2007 where the guy says something like "this is cool but why would anyone use it when you can just whip together ftp and svn on a debian box and have the same thing?"
- decasia 2y agoI think it kind of goes both ways. There are times when you absolutely want lambda functions instead of cgi-bin scripts. But conversely - there are times when you absolutely want cgi-bin instead of lambda. (For interfacing with other linux services or packages, for example). The two tools don't always substitute for each other.
- pixl97 2y agoI mean, that is the difference between using something because it's the flavor of the day and using something because it's the best tool for the job.
- Stratoscope 2y agoHere's the full quote: > For a Linux user, you can already build such a system yourself quite trivially by getting an FTP account, mounting it locally with curlftpfs, and then using SVN or CVS on the mounted filesystem. From Windows or Mac, this FTP account could be accessed through built-in software. https://news.ycombinator.com/item?id=8863 https://news.ycombinator.com/item?id=8863
- ikari_pl 2y ago
- decasia 2y agoI think the spirit of this article is correct, although some of the digs at modern web tech and SPAs seem to be beside the point. I used to have a "mildly dynamic website." It was a $5 digital ocean box. It ran nginx with php-fpm, mostly so it could have a Wordpress install in a subdirectory, and it had a unicorn setup for an experimental Rails app somewhere in there. Given that environment, the "mildly dynamic website" experience that TFA talks about was absolutely true. If I wanted a simple script to accept form input, or some little tiny dynamic experimental website, I could trivially deploy it. I could write PHP (ugh) or whatever other backend service I felt like writing. I ported the Rails app to golang after a while. It was fun. It made for a low cost of entry for experimental, hackish things. It's a nice workshop if you have it. The thing is — if you are running this setup on your own linux virtual machine — it requires endless system maintenance. Otherwise all the PHP stuff becomes vulnerable to random hacks. And the base OS needs endless security updates. And maybe you want backups, because you got lazy about maintaining your ansible scripts for system setup. And the price of the $5 virtual linux box tends to go up over the years. And the "personal website" model of the web has kind of declined (not that it's altogether dead, just marginalized by twitter/facebook). So I got exhausted by having to maintain the environment (I already do enough system maintenance at work) and decided to switch to static HTML sites on S3. You can't hack it anymore. But so far — I can live with it.
- layer8 2y ago> The thing is — if you are running this setup on your own linux virtual machine — it requires endless system maintenance. Otherwise all the PHP stuff becomes vulnerable to random hacks. And the base OS needs endless security updates. Just use Debian with unattended-upgrades. Done. Only rarely do you have to do anything manually. Setting up daily backups with verification is also a one-time thing.
- jimmaswell 2y agoA daily apt update/upgrade in crontab has been working fine for me. What is the maintenance beyond that?
- pixl97 2y agoAnd then you forgot to add "I had to stick it behind cloudflare because someone decided to DDOS it and send me 500GB/s traffic for no apparent reason at all. The early web was the wild west. The modern web has turned into small fry trying to hide in the shadows of megalodons so they don't get ate by a goliath.
- solardev 2y agoThis perspective isn't really making an apples-to-apples comparison. The author is comparing modern framework bloat to the simplicity of a standalone PHP script, but disregarding the underlying stack that it takes to serve those scripts (i.e., the Linux, Apache/Nginx, MySQL/Postgres in LAMP). Back in those days, it was never really as simple as "sftp my .php file into a folder and call it a day". If you were on a shared host, you may or may not have access to any of the PHP config, needed for things such as adjusting memory limits (or your page might not render), which particular PHP version was available (limiting your available std lib functions), which modules were installed (and which version of them, and whether they were made for fastcgi or not). Scaling was in its infancy those days and shared hosts were extremely slow, especially those without caching, and would frequently crash whenever one tenant on that machine got significant traffic. If you were hosting your own in a VM or bare-metal, things were even worse, since then you had to manage the database on your own, the firewall, the SSH daemon, Apache config files in every directory or Nginx rules and restarts, OS package updates, and of course hardware/VM resource constraints. Yes, the resulting 100-line PHP script sitting on top of it all might be very simple, but maintaining that stack never was (and still isn't). Web work back then was like 25% coding the PHP and 75% sys-admining the stack beneath it. And it was really hard to do that in a way that didn't result in customer-facing downtime, with no easy way to containerize, scale, hot-standby, rollover, rollback, etc. ===================== I'd probably break down this comparison (of LAMP vs modern JS frameworks) into questions like this, instead: 1) "What do I have to maintain? What do I WANT to maintain?" IMHO this is the crux of it. Teams (and individual devs) are choosing JS frameworks + heavy frontends because even though there are still servers and configurations (of course), they're managed by someone else. That abstraction and separation of concerns is what makes it so much easier to work on a web app these days than in the PHP days, IMO. Any modern framework now is a one-command `create whatever app` in the terminal, and there, you have a functioning app waiting for your content and business logic. That's even easier than spinning up a local PHP stack with MAMP or XAMPP, especially when you have more than one app on the same disk/computer. And when it comes time to deploy, a single `git push` will get you a highly-available website automagically deployed in a couple minutes, with a preconfigured global CDN, HTTPS, asset caching, etc. If something went wrong, it's a one-click rollback to the previous version. And it's probably going to be free, or under $20/mo, on Vercel, Cloudflare Pages, Netlify, etc. Maybe AWS Amplify Hosting too, but like Lambda, that's a lot more setup (AWS tends to be lower-level and offers nitty-gritty enterprise-y configs that simpler sites don't need or want). By contrast, to actually set up something like that in the PHP world (where most of the stack is managed by someone else), you'd either have to find a similar PHP-script-hosting-as-a-service like Google App Engine (there's not many similar services that I know of; it's different from a regular shared host because it's a higher level of abstraction) or else use something like Docker or Lando or Forge or GridPane to manage your own VM fleet. In the latter cases you would often still have to manage much of the underlying stack and deal with various configs and updates all the time. It's very different from the hosted JS world. The benefit of going with a managed approach is that you're really only needing to touch your own application code. The framework code is updated by someone else (not that different from using Laravel or Symfony or Wordpress or Drupal). The rest of the stack is entirely out of your sphere of responsibility. For "jamming" as an individual or producing small sites as a team, this is a good thing. It frees up your devs to focus on business needs rather than infrastructure management. Of course, some teams want entirely in-house control of everything. In that case they can still manage to their own low-level VMs (an EC2 or similar) and maintain the whole LEMP or Node stack. That's a lot more work, but also more power and control. A serverless func, whether in JS (anywhere) or PHP (like via Google Cloud Run), is just a continuation of this same abstraction. It's not necessarily just about high availability, but low maintenance. You and your team (and the one after them, and the one after that) only ever have to touch the function code itself, freeing you from the rest of the stack. It's useful the same way that being able to upload a video to YouTube is: You can focus on the content instead of the delivery mechanism. 2) Serverside resource consumption It's not really true that "PHP scripts don't consume any resources (persistent processes, etc.) when they're not being used", any more than a JS site or serverless func isn't consuming resources when they're not being used. Both still require an active server on the backend (or some server-like technology, like a Varnish or Redis cache or similar). Neither is really an app author's concern, since they are both hosting concerns. But the advantage of the JS stuff is that it's easier and cheaper for hosts to containerize and run independently, like in a V8 isolate (for Cloudflare Workers). It's harder to do that with a PHP script and still ensure safety across shared tenants. Most shared PHP environments I know of end up virtualizing/dockerizing much of the LAMP stack. 3) Serverside rendering vs static builds vs clientside rendering As for serverside rendering vs static builds, the article doesn't really do a fair comparison of that either. This is a tradeoff between delivery speed and dynamicness, not between PHP and JS. Even in the PHP world, the PHP processor itself offered caching, then frameworks like Wordpress would offer its own caching on top of that, then you would cache even the result of that in Varnish or similar. That essentially turns a serverside rendered page into a static build that can then be served over a CDN. This is how big PHP hosts like Pantheon or Acquia work. No medium or big size would make every request hit the PHP process directly for write-rarely, read-often content. In the JS world, you can also do serverside rendering, static builds, clientside renders, and (realistically) some combination of all of those. The difference is that it's a lot more deliberate and explicit (but also confusing at first). But this is by design. It makes use of the strength of each part of that stack, as intended. If you're writing a blog post, chances are you're not going to edit that more than once every few weeks/months (if ever again). That part of it can be statically built and served as flat HTML and easily cached on the CDN. But the comments might trickle in every few minutes. That part can be serverside rendered in real time and then cached, either at the HTTP level with invalidations, or incrementally regenerated at will. And some things need to be even faster than that, like maybe being able to preview the image upload in your WYSIWYG editor, in which case you'd optimistically update the clientside editor with a skeleton and then verify upload/insertion success via AJAX. The server can do what it does best (query/collate data from multiple sources and render a single page out of it for all users to see), the cache can do what it does best (quickly copy and serve static content across the world), and the client can do what it does best (ensure freshness for an individual user, where needed). It is of course possible (and often too easy) to mis-use the different parts of that stack, but you can say the same thing about the PHP world, with misconfigured caches and invalidations causing staleness issues or security lapses like accidentally shared secrets between users' cached versions.
- 101008 2y agoI feel identified with the first part of the article. I remember the problem about navigations and headers (and right sidebars!). The first solution was of course framesets, but they were kind of ugly. Then iframes came, and they were almost perfect solution (at least for me). With no borders, they looked like an include. The only problem (and depending of your website) it was that the height was fixed (for headers that may not be a problem, but it was for left and right sidebars). Of course, with PHP and includes everything became trivial. I kind of miss the old `index.php?cont=page1`...
- jimbokun 2y agoI sometimes wonder what the hell AWS Lambda is and whether or not I should care. Now I have a succint answer: > What captured people's imaginations about AWS Lambda is that it lets you a) give any piece of code an URL, and b) that code doesn't consume resources when it's not being used. Yet these are also exactly the attributes possessed by PHP or CGI scripts. From now on, when anyone mentions "AWS Lambda" I'm going to replace with "CGI" in my head.
- throwaway22032 2y agoBasically everything AWS is things we already have but more expensive because someone else does the easiest bit for you.
- tracerbulletx 2y agoI don't know how anyone who experienced how Ops worked at companies before AWS can say things like this. Is AWS right for everyone economically? No. It is an impressive automation of software operations, that has driven the industry forwards by leaps and bounds. Yes.
- jjk166 2y agoSome people don't want to create a universe every time they want an omelet.
- afavour 2y agoThe author’s assertion isn’t correct though. Yes, technically speaking a PHP script that isn’t being executed isn’t itself costing you money. But it’s stored on server that is running 24/7 and is costing you money. Set up in the traditional way, CGI/PHP is priced by server uptime, be that per hour, per day, per month, whatever. The server runs all the time, it waits for requests, it processes them. By contrast Lambda only costs money while your code runs. There’s a big difference there. Pricing of the two is different enough that a Lambda isn’t automatically cheaper but it’s misleading to suggest it’s just a CGI/PHP script. And we haven’t even started on the differences around scaling etc.
- amluto 2y agoI think the real ability that got lost is the ability to easily mix and match multiple logically separate things. Once upon a time, if you have some slightly dynamic material and you also wanted to add some PDFs from the technical writers, the webmaster would do it in five minutes. Want a video? Just add a file. Need a form? Fire up some PHP or whatever. Want a support contact or FAQ? No big deal. Now even big companies outsource their PDF hosting and viewing to a third party, they outsource their FAQ and support contact to a different fancy startup, surveys and similar forms to to yet another company, and the list goes on. The all-in-one website seems to be dead.
- foundart 2y ago+1 for the article's link to the "CADT Model" https://www.jwz.org/doc/cadt.html https://www.jwz.org/doc/cadt.html
- ss64 2y agoThis is missing any discussion of the dynamic functionality you can add with a bit of vanilla JavaScript.
- PKop 2y agoNo it isn't. Did you read the article?
- krapp 2y agoThe article's insistence on differentiation between "web sites" and "web applications" and a further article linked in the footnotes about the "HTML5 coup"[0] suggests the author doesn't consider functionality added by javascript to be valid for web sites, which they define as purely documents, only web applications. This seems to be a common viewpoint on HN, from what I've observed. [0]https://www.devever.net/~hl/xhtml2 https://www.devever.net/~hl/xhtml2
- jak2k 2y agoI like the idea of just renaming an `html` file to `php` and adding a bit dynamic stuff. A webserver that could do this with JavaScript/TypeScript would be cool! (Or maybe I should learn php…)
- leobg 2y agoYeah, I was shocked when, coming from PHP, I realized that in Python, in order to serve a website, you have to start and maintain an extra server process.
- motogpjimbo 2y agoDon't forget deploying updates by either (a) stopping your Python application and then restarting it, hoping your users are not too badly inconvenienced in the interim, or (b) rigging together some kind of blue-green deployment setup. Meanwhile, the PHP developer runs rsync and the deployment is done.
- notatoad 2y agoyou don't have to - apache will execute your python cgi scripts just as happily as it will execute your php cgi scripts. it's just that python developers figured out that having options other than cgi, and being freed from the rigid directory structures is really nice.
- tiroyi1717 2y ago[flagged]
- tiroyi1717 2y ago[flagged]
- leobg 2y agoMakes me think of Pieter Levels who used to run a 60k/mo SaaS with hundreds of paying users from a single index.php on a bare metal server. (I don’t know if he still does it that way.)
- syrusakbary 2y agoI'm amazed on how well this article fits with a new product that we have been working on at Wasmer. AWS Lambda is great, but it doesn't really solve the cold start problem of dynamic languages. Nor does FastCGI. We are very close to launch Instaboot, a new feature for Wasmer Edge that thanks to WebAssembly is able to bring incredible fast cold-starts to dynamic languages. Bringing 90ms cold-start times to WordPress (compared to >1s in state-of-the-art cloud providers).
- kolme 2y agoFun fact: nextjs was inspired by PHP and can generate static pages that you can throw into a web server. Another technology that kind of covers the use cases of the article (the mildly dynamic pages) would be htmx and friends.
- 1vuio0pswjnm7 2y ago"Or, suppose a company makes a webpage for looking up products by their model number. If this page were made in 2005, it would probably be a single PHP page. It doesn't need a framework - it's one SELECT query, that's it. If this page were made in 2022, a conundrum will be faced: the company probably chose to use a statically generated website. The total number of products isn't too large, so instead their developers stuff a gigantic JSON file of model numbers for every product made by the company on the website and add some client-side JavaScript to download and query it.... This example is fictitious but I believe it to be representative." As an end user, I have seen this perplexing design pattern quite often. As soon as I see it, I just get the URL for the JSON file and I never look at the web page again. It is like there is so much bandwidth, memory and CPU available but the developer is not letting the user takes advantage of it. Instead the developer is usurping it for themselves. Maybe a user wants to download data. But the developer wants to run Javascript and keep _all_ users staring at a web page. Why not just provide a hyperlink on the rendered search results page pointing to the JSON file, as an alternative to (not a replacement for) running Javascript. What are the reasons for not provding it. On some US government websites, for example, a hyperlink for the the CSV/JSON file is provided in the rendered search results page.^1 That is why a non-commercial www is so useful, IMHO: the best non-commercial websites do not try to "hide the ball". Perhaps they have no incentive to try to force users to enable Javascript, which is a practical prerequisite for advertising and tracking. 1. ecfr.gov and federalregister.gov are two examples
- 1vuio0pswjnm7 2y agoepa.gov is another example
- spacebuffer 2y agoSemi-related: what's the best place to learn the old school style of working with php, I already know laravel but it feels so far removed from normal php that I am not confident working with it on it's own.
- hu3 2y agoI would try some "old style" php frameworks. Like CodeIgniter or Yii. If you want even simpler, then maybe try Slim framework. You'll have to add your own data access lib. If you want Grug brain PHP then there's https://github.com/bcosca/fatfree https://github.com/bcosca/fatfree You can also use composer package manager to build your framework with libs like routing, sql query builder, etc.
- wild_egg 2y ago> Fast and clean template engine Is PHP not already a template language? The whole idea of PHP frameworks always confused me. Why do I need a router when I can simply add new files at the routes I want?
- hu3 2y agoYou're right, it is. The advantage of a router is basically: please always execute this code (auth, db connection, logging, session, rate limiting, csrf protection) before running the actual code for pages that will be rendered. Or you could also just keep using normal page.php files and possibly include a boot.php at the top of the pages to achieve the same. But then you don't get pretty URLs unless you're doing some server URL rewriting. Come to think of it, routers require URL rewriting too.
- oopsallmagic 2y agoWhy not read the PHP docs and any tutorials they might have? The docs are pretty comprehensive.
- dventimi 2y ago
- lovasoa 2y agoThis article resonates with me. I do love "mildly dynamic websites", and have fond memories of my days hacking together PHP websites 15 years ago. And what I am working on today might be called a bridge for the "dynamicity gap". I'm making an open source server to write web apps entirely in SQL ( https://sql.ophir.dev/ https://sql.ophir.dev/ ). It has the "one file per page" logic of PHP, and makes it easy to add bits of dynamic behavior with just a normal INSERT statement and a SELECT over dynamic data.
- Legion 2y agoPHP deployment was indeed easy. But it turns out "dump everything in docroot and let mod_php interpret and execute whatever it finds there" had security implications...
- cies 2y agoindeed. the gap with PHP and alternative stacks has mostly closed. PHP apps now alse get deployed by container or VM... so why not go with something like Kotlin + kotlin.html (HTML eDSL for server-side templating and HTMX), Ktor or http4k (web libs), jOOQ (SQL eDSL with some typesafety on queries) and Postgres? the PHP, MySQL (MyISAM), mod_php, Apache days are over. and it's not only for security reasons: there are alternatives that score better in every dimension AND run/deploy well on cheap hosting
- oopsallmagic 2y agoYou always had to configure your web server properly. "Don't let programs execute arbitrary code" was a solved problem even then.
- Dwedit 2y agoI think CDNs led to the demise of "mildly dynamic" websites. They made static websites get served super fast, so you got the most benefit from completely static sites. You could still include a small amount of JS to make a mostly-static site partially dynamic if you were logged in. Limited mostly to things like including the user's username on the page when logged in.
- Reason077 2y agoI dunno. Isn't HN an example of a "mildly dynamic website"?
- resoluteteeth 2y agoThe article is talking about things like pages that are primarily static but with a comment box added as a dynamic part. In this sense, I think the entirety of HN would count as "dynamic" by the standard in the article, so it would not be "mildly dynamic". Are you thinking about something like "progressive enhancement" with JavaScript? Because that is not what the article is describing as "mildly dynamic".
- simonbw 2y agoI think some of this article resonates with me, but I also think a big part of it rubs me the wrong way. It seems to assume that everyone has a webserver running a LAMP stack. If you have a static site on a webserver running PHP then of course PHP is going to require the least amount of effort to make your site mildly dynamic. On the other hand, if you have nothing, I don't think that the fastest/easiest way to a mildly dynamic website is to use PHP. I got curious about the most minimalist setup I could get for running a static site that would also easily transition to becoming dynamic piece-by-piece. Here's what I came up with using NextJS: 1. Create a `package.json` containing: { "scripts": { "dev": "next dev", "build": "next build", "start": "next start" }, "dependencies": { "react": "^18", "react-dom": "^18", "next": "14.2.4" } } 2. Create `app/layout.js` containing export default ({ children }) => children; 3. Create your home page at `app/page.js`. This is pretty much just what your index.html would have been before except it's wrapped with `export default () => (/.../)`: export default () => ( <html> <head> <title>Home</title> </head> <body> <h1>Home</h1> <p>Welcome to our website!</p> </body> </html> ); 4. Put the rest of your static files in `/public` Now, when you want to make one of your html files dynamic: 1. Move it from `public/your-page.html` to `app/your-page/page.js` 2. Wrap it with `export default () => (/.../)` And there you go, you can start using JavaScript and JSX in your page. Here's a summary of the differences between this approach and creating a PHP-based site: 1. You have to create 2 more files containing 13 more lines of code than you would with PHP 2. You need to find a NextJS web host rather than a PHP web host 3. Your dynamic pages are html-inside-javascript rather than php-inside-html. You are also technically writing JSX and not HTML, which has slightly different syntax. 4. You have a much easier to set up local dev server (Install `node`, then `npm install` and `npm dev`) 5. This framework can scale pretty seamlessly to "highly dynamic", whereas with PHP you'd probably need to introduce a frontend framework if you wanted to create something actually "highly dynamic". 6. You only need to learn one programming language (JavaScript) instead of two (JavaScript and PHP).
- nucleardog 2y ago> It seems to assume that everyone has a webserver running a LAMP stack. Shared hosts are pretty near a dime a dozen. Or just `apt-get install apache2 libapache2-mod-php` and you’re ready to go with no project changes. > You have a much easier to set up local dev server (Install `node`, then `npm install` and `npm dev`) Which version of node? Which version of npm? When I come back to this in six months am I going to find out some dependency relies on a dependency that relies on a dependency that only works on node 3.14 and end up installing nvm and stepping through versions trying to get this running? For PHP I will need to install PHP. For this kind of stuff basically any version from the past decade will work. It’s in every package manager everywhere, has a windows installer, etc. (There’s a reason every PHP dev isn’t using a PHP equivalent to “PHP version manager”.) Once that’s installed, just `php -S 127.0.0.1:8000` and open it in your browser. Serves all your static files and stuff too without any changes to any of them—an existing jumble of HTML and CSS is a 100% valid PHP project. It’s usually substantially easier for me to get a ten year old PHP project running than a six month old JS project.
- Terretta 2y agoWhy should we “not speak of” Allaire's ColdFusion also released in 1995? PHP made web development accessible with its simplicity, but ColdFusion was arguably more influential in the '90s. It led the way with features like built-in database connectivity and templating, setting the stage for how dynamic web pages would work as implemented by Microsoft and others, and even shaping what PHP itself became. Separately, I think projects like Caddy carry on the spirit of the blog post.
- ArneBab 2y agoI know why I no longer have a mildly dynamic website: the security risk of PHP is not linear. That’s where Javascript shines: if you avoid comments (those are actually a hard problem: a social one) and server-side data (security risk), it actually has this linear increase in effort without the jump in security risk. And this risk has increased a lot since the early mildly dynamic websites.
- ggm 2y agoLooking stuff up in an SQL DB and showing it to the masses (wordpress) is not very dynamic. But, neither is deploying neko the cat to sleep on your cursor, or the dancing turtle of Kame-IPv6. Intruding PHP into the actual FQDN of the web, and making 3x4.ARITHMETIC.EXAMPLE.COM work as a calculator, now thats dynamic. REST is pretty dynamic. If I GET it and then POST it back with changes, I feel like I've had a good day. I personally hate the cursor implicit in tabular data websites. There should be a normative "no cursor" mode to just get all the damn data not the page management requirement. Riddle me this: How does "the independent" newspaper create a high visual content web which on my tablet appears to render INSTANTLY and yet has 100 points of image and text? it loads faster than almost any other site. It also kills my CPU and is a terrible design, but my goodness it's fast.
- lwhi 2y agoOnce upon a time there was a technology called dHTML. Waaaay before Web 2.0 and full interactivity on the client.
- alexanderscott 2y agoI feel every admin panel I’ve built over the years, including recently, have been “mildly dynamic”. only enough jquery to be usable by other staff.