I am new to Mac OS X, and I have a MacBook Pro. I am developing a web application with PHP and MySQL. I already installed XAMPP on my Mac. I discovered the option for hosting in System Preferences > Sharing > Web Sharing, but I don't know how to use it or how to tell my friend to view my web application remotely. Can someone help me?
Web Sharing opens port 80 (http) on your machine and points any incoming requests to
~/Sites. You'll want to put your PHP app there for it to work through Web Sharing. I'm not sure if there is any further configuration you have to do on the PHP/MySQL side since I don't know anything about either of those languages. That's probably a question for SuperUser.
As far as accessing it remotely, you'll need to open port 80 on your router and point it to your computer's internal IP address. Then you'll want to give your friend either your domain name or your current IP address from your ISP and have them type it in their web browser.
You just tick the box, an then anyone who doesn't get blocked by your firewall can view the site, either by domain name or IP address.
PHP is installed but disabled by default, you need to enable it i httpd.conf (not sure what the exact path is). Just search for PHP and uncomment anything relevant. Any change needs a restart of Apache (untick web sharing, wait, and tick it again).
MySQL isn't installed by default, but mysql.com has a pkg installer for it, and apple has already configured PHP to connect to it (via root@localhost with no password).