Dang, finally....
Look, I'll be frank, that was a lot!
If you just devoted hours attempting to find a solution only to find yourself stuck on the same problem after finding that someone else's Mac solution isn't yours, then I feel you.
Moreover, by now you might have a chip on your shoulder regarding XAMPP, and you might be tempted to trade in XAMPP for MAMP, but whoa slow your roll champ. Here's a tip: it's the chip.
Some said that the Xampp ~~is not compatible ~~ with the M1 chip, but that's false.
Here are the steps to downloading XAMPP version 8.1.2 for Mac OS X:
1.Go to https://www.apachefriends.org/index.html
2.In the nav-bar choose download
3.Scroll down to the XAMPP for OS X section
4.click the More Downloads link
5.then click the XAMPP Mac OS X
6.then choose one of the two versions that are compatible with the M1 chip: version 7.4.27 and version 8.1.2 (I can only vouch for the version I downloaded, such as 8.1.2.)
7.download xampp-osx-8.1.2-0-installer.dmg
8.After downloading, click the start all servers button
9.If Mysql Database server stopped and is not running, run these two commands in the terminal
sudo killall mysqld
sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start
10.then open your browser and type localhost in the address bar and press enter.
11. If you see "Welcome to Xampp for OS X 8.1.2" then the installation was successful.
-Locate and open Xampp in your finder folder.
-Locate and double click htdocs.
-create a new project folder in htdocs. Name the folder. For example, testing.
12. Drag that folder into your IDE or VSC or the alike and get to work.
13.To deploy it locally, open your browser,and concatenate localhost/+the name of your project folder. For example, localhost/testing.
14. Please do congratulate yourself, you did a good job!