I don't use PHP and have a Ryzen linux machine that hard freezes every so often (around once per week) with nothing in logs. Have pretty much given up on debugging it.
You should contact AMDs support and let them figure it out with you. From what I hear they treat that issue seriously by now, and if your processor turns out to be faulty they should offer you a RMA.
Though hard freezes not during compilation should be a completely different issue, and it will be an effort to pinpoint the processor as responsible.
Yeah, we pretty sure it's not a RAM, PSU, or SATA disk problem (because we had multiples of different kinds to swap around), and we also know that the problem gets much much worse when using an M2 NVMe PCIE SSD (as in hard freezes occur way more frequently, regardless of M2 model). (And it's also possible that the M2 issue is a different problem entirely.) But it could still easily be some kind of motherboard issue. And with it only happening around every 9 days on average... We could contact AMD, but how the heck do we ever narrow down what's going on if we can't trigger replication more frequently? And that's time that my actual job isn't getting done...
(I'm personally inclined to think Mobo is at fault.)