Accessing your Local Web Server from a Mobile Device using XAMPP
May 5, 2016
If you are using XAMPP to do PHP development and you want to test your pages on your iPhone, you will need to:
- Find your local IP address
- Configure XAMPP to allow access from your mobile device (not necessary on Macs).
Find Your Local IP Address
Your local IP address will be something like 192.168.2.21.
- To find your local IP address on Windows, open a command prompt and type
ipconfig. You’re looking for the IPv4 Address.
- To find your local IP address on Mac, open Terminal and type
ifconfig | grep "inet " | grep -v 127.0.0.1. It will be be the first address after “inet”.
Once you know the IP address, on your mobile device, open a browser and point it to http://192.168.2.21 (change to use your IP address). If you’re using a Mac, that should work. If you’re using a PC, your likely to get a 403 error, like this one:
Configure XAMPP to allow access from your mobile device
You may get a 403 error when you navigate to your Windows’ web server from your mobile device. If you do, you need to make a small change in the httpd-xampp.conf file:
- In the XAMPP Control Panel, next to Apache, click on the Config button and open httpd-xampp.conf:
- In the bottom of the file, change
Require all local to
Require all granted.
- Stop and Start Apache and then try loading the page in your mobile device’s browser. It should now display the XAMPP homepage.
Related Training: PHP