I wouldn't consider XAMPP to be especially bad for a production environment. Some or all of the XAMPP components host, for example, the Wikipedia.
The PHP language is a little weak on security compared to
JEE, but then most non-JEE language environments are. Perl, of course, is dangerous in anyone's hands.
So to avoid abuse, there are a couple of things you can do.
First of all, consider a firewall. I routinely blocked traffic from Korea and Russia because of so much bad-faith traffic I saw coming from there. Not long ago, I even went out and bought an actual firewall appliance on EBay to choke off a lot of stuff before it annoyed my server's own firewalls. The device is past vendor end-of-life, but I don't need its fancier features (where most of the security patches are needed) so it was a worthwhile purchase.
Secondly, keep the XAMPP system and the OS up to date. Security fixes come out all the time. And in the "X" part, while Windows is a LOT more secure than it used to be, Linux is a lot easier to keep updated, especially if you want to be in control of the updating.
And finally, most importantly, be paranoid when you design apps for the system. All the firewalls and security patches in the world won't help if you don't code secure apps.