🔧 Step 1: Install XAMPP
- Download and install XAMPP.
- Make sure Apache (and MySQL if needed) is installed.
▶️ Step 2: Start Apache Server
- Open XAMPP Control Panel
- Click Start next to Apache
- (Optional) Start MySQL if your project uses a database
📁 Step 3: Place Project in htdocs
Move your project into:
C:\xampp\htdocs\your-project-folder
Example:
C:\xampp\htdocs\blog-app
🌐 Step 4: Run Project on Your Own Laptop
Open browser and visit:
http://localhost/your-project-folder
✅ Your project should now run locally.
📡 Step 5: Access Project from Mobile or Other Laptop
This is where most people get confused — follow carefully.
📶 شرط (Important Requirement)
All devices must be connected to the same network:
- Same WiFi
OR - Same mobile hotspot
👉 Example:
Your laptop + your phone both connected to same WiFi router OR your laptop hotspot.
🔍 Step 5.1: Find Your Computer IP Address
On Windows:
- Open Command Prompt
- Run:
ipconfig
- Look for:
IPv4 Address: 192.168.X.X
Example:
192.168.1.5
🌍 Step 5.2: Use IP Instead of Localhost
On your mobile or another laptop, open browser and type:
http://192.168.1.5/your-project-folder
👉 Replace:
192.168.1.5with your actual IPyour-project-folderwith your project name
⚠️ Step 5.3: Allow Firewall Access
Sometimes it won’t work due to firewall blocking.
Fix:
- Open Windows Defender Firewall
- Click Allow an app through firewall
- Allow:
- Apache HTTP Server
- Or temporarily turn off firewall (for testing only)
⚙️ Step 5.4: Check Apache Port
Default Apache runs on:
Port 80
If changed (example: 8080), use:
http://192.168.1.5:8080/your-project-folder
🧪 Step 6: Test Connectivity
If it doesn’t work:
- Try opening:
http://192.168.1.5
If XAMPP dashboard opens → network is working ✅
❗ Common Issues & Fixes
🚫 1. Mobile Cannot Access Site
- Not on same WiFi ❌
- Wrong IP address ❌
- Firewall blocking ❌
🔥 2. Apache Running But Not Accessible
- Check firewall settings
- Restart Apache
- Use correct port
🌐 3. IP Address Keeps Changing
- This is normal (DHCP)
👉 Solution:
- Re-check IP using
ipconfig - Or set static IP (advanced)
🗄️ 4. Database Not Working on Mobile
If your project connects to database:
- Make sure DB host is:
localhost
✔ Works fine because DB runs on same server
📂 5. Project Not Found
- Ensure project is inside:
htdocs
- URL spelling must match folder name exactly
🧠 Pro Tips
- Use hotspot from your laptop for quick testing
- Keep project folder name simple (no spaces)
- Use
.envfile for config if project supports it - Restart Apache after any config changes
✅ Final Flow Summary
- Install XAMPP
- Start Apache
- Put project in
htdocs -
Run on:
http://localhost/project - Find IP using
ipconfig -
Access on mobile:
http://YOUR-IP/project - Ensure same network + firewall allowed
🚀 Conclusion
Now you can:
✔ Run PHP project locally
✔ Access it from your phone
✔ Share it with other devices on same network
This is very useful for:
- Testing responsive design
- Demo to clients
- Multi-device debugging
Comments
No comments yet.