For the best experience on desktop, install the Chrome extension to track your reading on news.ycombinator.com
Hacker Newsnew | past | comments | ask | show | jobs | submit | history | more jslaby's commentsregister

WA was the only state to decrease in Trump vote margin


Happy to be of service


First time hearing that one, no doubt coined and promoted by Oracle themselves


The key is to jump jobs before they catch on


It's not even amplified just from his account but the site itself. Create a new account and follow something like sports or entertainment.. then see what floods your feed. I logged in first time today, and it's quite shocking actually. Not a single left leaning account, just all maga that outnumbers the sports or whatever you clicked as interests.


Is it even strange, considering that elections just happened and who’s gonna be the new president?


I just created an account on X and the list that pops up to follow: Elon, Terrence Williams, Sebastian Gorka, Dinesh D'Souza, Rand Paul, Dan Bongino, Leo Terrell, Tom Fitton, Mark Levin, Tiffany Smiley, Breitbart News, Matt Gaetz... not a single "left leaning" account other than Joe Biden and maybe Neil Degrasse Tyson, but I chose sports and science as my interests. Open and free speech, right..


Since it’s the platform that takes freedom of speech the most seriously, it caters to people who are for freedom of speech.



Oh yeah this thing that went against X rules?

https://x.com/MJTruthUltra/status/1839463404286746770

To be fair they could censor a million differing opinions and still be the free speech platform among competitors.


'Freedom of speech', in this context, should be read as 'stuff Musk likes'.


The above example was a case of their rules against doxing - publishing JD Vances address and phone number, which is applied pretty evenly to all doxing.


I don't even know why they bother with that kind of research. It's obvious that Trump can just lie and all his supporters believe it because they have a propaganda arm that's perceived as "news". The Trump believers all think that "MSM" is lying to them but for some reason they think that Fox and NewsMax and Alex Jones aren't (when the exact opposite is true).

It's like the whole hush money thing. Turns out it just doesn't matter, they should have let Stormy Daniels say whatever she wants because Trump just has to go on stage and make stuff up and then Hannity will repeat it and it becomes right-wing canon.


The Michael Moore Human Molotov Cocktail speech explains a lot https://youtu.be/TEHekdQSiXg


He’s going with the old classic: the opposite side is brainwashed and dumb!

Another home run.


/s


Yeah, I read that thinking it was Instagram Threads... and was confused to the cheery tone of the announcement.


Long time C# dev, now I primarily code in PHP8 which is a great language to quickly get things done. This is the kind of direction the language needs to go in, instead of the older LAMP which can require somewhat complex Apache configuration.


PHP dev of 18 years here.

Use nginx with php-fpm. It takes 5 minutes to configure.

Edit: I'm gonna give this thing a try too but I've never had any bottlenecks with either nginx or Apache. They both take a few minutes to get going at most.


Few seconds with docker. There are fully loaded compose ones that include everything so you don’t need to add anything. It’s lovely. For prod it’s better to only leave the needed extensions etc of course but for dev it’s so easy to get going. And to be honest, for small personal, company internal and less than $1000/mo rev saas, we just use the fully loaded in prod as well.


How does your production one look like if I may ask?


>It takes 5 minutes to configure

Is that because you have 18 years of experience, or would it be as easy for a new developer?


I was a long-time PHP dev and then moved on to C#. I was close to writing this nginx/fpm setup lookss very complex compared to "dotnet run". But then I remembered, in ASP.NET you have a Program with 50 lines of code that must have an exact order, otherwise thinks work except they don't.

So I would say, knowing these two languages, PHP really is that easy to setup.


This has not been true for a long time.


You won’t find this answer very satisfying, so feel free to ask questions.

But it depends on what you’re trying to accomplish. If you’re sticking with defaults, it’s very easy - it’s less than ten minutes of work or seconds if you’re comfortable working with Docker.

On the other hand, let’s say that you’re running into problems scaling to handle more requests. You’ll end up having to tweak the max_workers setting. That takes a bit of experience or it can be a lot of ‘fun’ (in the Dwarf Fortress sense).

So yes and no. But a lot of people have been through this, have all the trauma you would receive and tend to be quite helpful.

You can do it!


I just have the right config for both Apache2 and nginx from hundreds of sites. The config itself is only 50 lines. You can find a good one and stick with it.


Yup. The process of finding alone will take more than 5 minutes. And is likely to not work for your particular circumstance.


You can have a a ~20 line docker-compose.yml file that only requires you to `docker compose up` and you're up and running. It's gotten insanely easy to run php-fpm + nginx + [whateverdb] in a set of docker services that require virtually no configuration.


And who is going to write that ~20 line compose file with "no configuration"? A newbie?


An LLM of course. They are really good at “trivial but you have to find a good tutorial” types of work.


When you're configuring Internet facing Linux services you're kind of out of the newbie area.

A newbie is more likely to use the built-in development server and then SFTP a 'git archive' to a shared host.


The original comment was about newbies. Everyone is a newbie at one point.

Just last year I tried a blog engine written in PHP. 24 years programming experience, but I haven't touched PHP for 10 years, and I haven't touched configuring it for 15+ years.

It took me half a day to make it work.


What blog engine? Usually with PHP applications you clone the repo, copy .env boilerplate, enter database credentials, run Composer to fetch dependencies and do some setup tasks, then boot the application.


I really wish people would maintain conversation context for at more than a single reply.


I think it would be roughly that easy for anyone with basic nginx experience. Nginx includes a php fast-cgi snippet that you just `include` from your server block.

It really is very easy.


It takes 5 minutes to configure with the defaults. But once you need to optimize PHP-FPM to handle more requests, you now find yourself fiddling with pm.max_children etc settings and need to know what you are doing. I love working with PHP and Go both btw. But PHP configurations can be a pain if you do anything other than defaults.


Apache with mod_php actually takes just "apt install libapache2-mod-php8.2" to work.


You shouldn't use mod_php.

It's a security nightmare. https://www.php.net/manual/en/security.apache.php

Even Apache httpd discourages the usage of mod_php. If installed, Apache recommends some extra configuration to limit memory leaks. https://cwiki.apache.org/confluence/display/HTTPD/php


There are a lot of strange assumptions on that first page:

- "for example, if you are using PHP to access a database, unless that database has built-in access control" - well, of course I will use a database with access control like MySQL

- "It's entirely possible that a web spider could stumble across a database administrator's web page, and drop all of your databases". Of course I won't run PHPMySQLAdmin or Adminer on a production server, nor will I expose it to the public.

- also none of the above has anything to do with the PHP execution model

The second page might raise some valid issues but for instance the bullet point "mod_php is loaded into every httpd process all the time. Even when httpd is serving static/non php content, that memory is in use" - doesn't matter to me when I am running everything through index.php routing anyway.

"mod_php is not thread safe and forces you to stick with the prefork mpm (multi process, no threads), which is the slowest possible configuration" might be true but also a premature optimization.

Maybe mod_php is really bad but the arguments presented here are not very convincing to me.


Why use mod-php when you have fcgi and fpm?


It's simple and there is less overhead. Since PHP runs directly within the Apache process, there is no need for inter-process communication (no TCP, no sockets), reducing the overhead. This can lead to lower latency for individual requests.


mod_php does give you better response times for individual requests, but at the expense of being able to handle a higher load of traffic; you'll run out of memory and/or experience timeouts on mod_php way before you do with php-fpm.

With mod_php, every Apache process has the PHP engine embedded in it, even if PHP isn't needed, e.g., to serve a request for a .css file. When Apache gets a bunch of requests for flat files, it forks all those processes and fills up RAM with copies of the PHP engine that aren't used. That's not only wasteful, but it dramatically increases the chances that you'll run out of memory. You can limit the number of Apache children of course, but you'll see timeouts sooner when you get a traffic spike.

By having Apache proxy over to php-fpm for PHP requests, you can configure Apache to use mpm_event for serving static files, which allows for much leaner Apache workers (memory-wise) since they aren't carrying PHP around on their backs.

While you're at it, you can use haproxy on the same machine for TLS termination, then you can disable mod_ssl thus making Apache workers even lighter.


> With mod_php, every Apache process has the PHP engine embedded in it, even if PHP isn't needed, e.g., to serve a request for a .css file. When Apache gets a bunch of requests for flat files, it forks all those processes and fills up RAM with copies of the PHP engine that aren't used. That's not only wasteful, but it dramatically increases the chances that you'll run out of memory. You can limit the number of Apache children of course, but you'll see timeouts sooner when you get a traffic spike.

Yes, that is true. But most high-traffic websites will cache static files such as CSS files and images, using a reverse proxy (e.g. Varnish, a CDN, or usually both). So I don't think this is a real problem, most of the time (99.9%?), a request for a static file will not hit Apache.

I'm not saying mod_php is better for all scenarios, of course, but I think it can be ok.


I tend to agree with you - using in "default" setup with mod_php and mpm_prefork is known to be far from optimal (still fine for blog about you and your cat).

With reverse proxy in front of such setup is - much better in terms of performance. For shared hosting - yet again, may be not optimal if one needs to support multiple system users.


Just as a reminder, you can use Caddy + php-fpm as well (with vanilla Caddy, no plugins).

What this does is give you a way to run your webserver + PHP as a single process, or single Docker container (instead of the traditional 2-container approach), and it also unlocks the ability to run PHP in a worker mode, where you have long-running PHP processes that have your framework loaded in memory ready to serve requests, instead of booting the framework on every request (so, much lower request latency).


Caddy uses more RAM and has no inherent benefit when running a project in production professionally. Caddy is easier for self hosted cause it automatically handles HTTPS where Nginx does not.

Related reading:

https://blog.tjll.net/reverse-proxy-hot-dog-eating-contest-c...


I'm a pretty hardcore nginx fan with a decent chunk of rather low level professional experience with it in complex setups. The reason I'd still pick nginx over Caddy for prod is that I know really well how a broader tool set will work together, e.g. keepalived and whatnot.

Caddy kind of feels like a cute toy in comparison with nginx, but it's not, by now it's been seriously battle tested and has proven itself to be quite resource efficient and resilient.


keepalived? What do you mean?


It's a tool you tend to come across when you're building highly available network systems, https://github.com/acassen/keepalived .

You might use it to implement redundancy in the load balancer layer of your system, perhaps your firewall round-robins incoming connections between two IP:s where you have nginx proxying to share load between two mirrored clusters, and those IP:s are virtual and handled by keepalived that will shuffle in a backup virtual server if the one currently serving becomes unhealthy or needs to be switched out due to a config rollout or something.

It's a really neat way to be able to just throw more virtual servers at the problems in availability, redundancy, load balancing and so on. I think it does some ARP messaging to achieve this.

Edit: I've applied it with ProxySQL in one case, it was an application on a trajectory from a simple rig with one virtual web server, one virtual database server to a highly available and resilient system. When I left we had a master-master-cluster with ProxySQL in front, with three ProxySQL-machines keepalived, so in case one went out for some reason there where two more in the stack to fill in. When you aren't sure what kind of peak load you're going to handle it's nice to know that when the alarm comes you have one fresh machine buying you some time while you figure out what you need to do to the third before it is shuffled into service.


I think that OP really meant that in his/her mental model of things, answers already known and battle tested for numerous cases [by using Nginx] - making HA with keepalived? Check. Making logging to be buffered to save iops? Check. Implementing ratelimits and custom logic? Check.

Keepalived is not really bound to Nginx by any means and should perfectly fine work with Caddy too.


Yeah, precisely. I'm sure it works fine with Caddy too, it's just that I haven't had Caddy with me in the trenches, yet.


Caddy “uses” more ram because Go is a garbage collected language. It can free tons of it, but that costs cpu cycles. It generally won’t spend too much time freeing memory until the system is under pressure.

Because it’s Go, you can tune garbage collection to be super aggressive, at the expense of speed.


Can you actually tune GC in Go though? As far as I'm aware, it's still abysmal at throughput optimization.


Yeah, you can tune it. There's a whole section in their docs about it.


> has no inherent benefit when running a project in production professionally

Tell that to Stripe and Framer and numerous other businesses using it very seriously and very much professionally! ;)


Citing that particular blog post isn't making the point you think it makes. To quote:

> The most striking piece of new knowledge for me was learning about failure modes. Nginx will fail by refusing or dropping connections, Caddy will fail by slowing everything down.

Do you want your clients failing to load your website at all? Is this the best approach to serving users?


> Do you want your clients failing to load your website at all? Is this the best approach to serving users?

There are good reasons for picking either. Large services under sudden load sometimes implement queueing, which is just failing but stylish.

For my blog posts, I'd rather throw an error than have people wait for thirty seconds. The contents aren't that important and the end result will probably look bad because of missing CSS anyway.

For API services, I'd want things to slow down rather than fail, unless failure is explicitly documented in the API and can be handled somewhat gracefully.


I agree. Having separated php processing and http processing brings good practices and helps further scalation.


And to add one more option to the comments (beyond [frontend] + php-fpm):

Nginx Unit https://unit.nginx.org/ - like Apache + mod_php runs as a single service, handles the multiprocessing of php (and other languages), static files, reverse proxy and even lets you configure both itself and php via a single configuration (either as a file or dynamically at runtime, via a socket): https://unit.nginx.org/configuration/#php

Here is an IRL config example: https://github.com/PrivateBin/docker-unit-alpine/blob/master...

The resulting container image can be pretty small: https://hub.docker.com/r/privatebin/unit-alpine


>This is the kind of direction the language needs to go in, instead of the older LAMP which can require somewhat complex Apache configuration.

I hardly every set up PHP (once each time I reinstall my desktop, which was last in ... 2018?) but I recall it being very quick and smooth using apt-get.

I don't recall doing anything else other than restarting apache.


> ...instead of the older LAMP which can require somewhat complex Apache configuration.

Is it really that bad? The Apache configuration seems decent with something like PHP-FPM: https://news.ycombinator.com/item?id=40256843

  LoadModule proxy_fcgi_module "/usr/lib/apache2/modules/mod_proxy_fcgi.so"
  <FilesMatch \.(php|phar)$>
    SetHandler "proxy:fcgi://127.0.0.1:9000"
  </FilesMatch>
Here's a more full example of Nginx that's quite conceptually similar to how one would configure Apache, with installing the prerequisite packages: https://news.ycombinator.com/item?id=37443911

There are also prebuilt container images that you can use to achieve similar results, this is just in case you want to do it yourself and have a look at what's under the hood a bit more.

In my eyes, that's certainly easier than configuring the Java app servers of old, like doing manual Tomcat or GlassFish configuration or whatever people spent time on back then. A single run command will usually be better regardless of the environment, but LAMP isn't all that bad either, when compared to the other stacks out there.


I agree. If we can start a culture of relying on SQLite instead of PostgreSQL/MySQL, a whole server-side application can be a simple standalone binary.

Also, having a binary makes it easy to bundle in an Electron app.


Laravel is defaulting to SQLite now (mainly for ease of development). Also FrankenPHP has SQLite included by default. Going that route is less scalable though, obviously, unless you use one of those third party SQLite cluster solutions.


I cut my teeth as a WordPress dev and left the scene for .NET when it was still popular to use Vagrant to setup your dev environment. While I'm glad things have progressed since then, I have a trauma response to those days. The amount of hours spent getting a proper config with XDebug setup (oh god, what an absolute backwards-ass nightmare) was substantial.


She was making $2936 a month teaching with a PhD? Even if it is part-time, that seems fairly low. She had 120 students in each class, let's say tuition is about 5k per class which comes out to $1.2 million. Revenue at universities have increased dramatically and is approaching nearly a trillion total.


There's no content. You should have at least the first item completed so the reader gets a sense of your teaching style and whether they want to pursue further.


Another JS UI, yay! How about we get some UI libraries for native built apps?


Great idea! Do you have any ideas for how you'd like to build it?


FlatLAF is a great one https://www.formdev.com/flatlaf/


Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search:

HN For You