如何在两台不同房间的电脑上共用同一WAMP Server?
Hey there! I’ve helped lots of folks set up shared WAMP servers across multiple machines, so let’s walk through exactly how to get your two room-separated computers working together smoothly:
1. First, make sure both computers are on the same network
This is non-negotiable—they need to be connected to the same LAN (either via WiFi or Ethernet through the same router/switch). To confirm:
- On each computer, open Command Prompt (Win+R, type
cmdand hit enter) - Run
ipconfigand check the IPv4 address. Both should be in the same subnet (e.g.,192.168.1.xor10.0.0.x) - If they’re not, double-check your router’s DHCP settings or manually assign static IPs in the same range.
2. Configure the WAMP host computer
This is where the bulk of the setup happens. Let’s break it down:
2.1 Allow Apache to accept external connections
- Left-click the WAMP icon in your system tray, go to Apache > httpd.conf
- Find this block of code:
<Directory "c:/wamp/www/"> Options Indexes FollowSymLinks MultiViews AllowOverride all Require local </Directory> - Replace
Require localwithRequire all granted(this lets any device on the network access your WAMP files) - Also, verify the
Listen 80line is uncommented (no#at the start). If port 80 is taken by another app (like IIS), change it to something else likeListen 8080
2.2 Enable remote MySQL access (if you need to use databases from the second computer)
- From the WAMP tray icon, go to MySQL > my.ini
- Locate
bind-address = 127.0.0.1and change it tobind-address = 0.0.0.0(this makes MySQL listen for connections from all devices) - Next, create a MySQL user that can connect remotely:
- Open phpMyAdmin via the WAMP tray menu
- Go to the User accounts tab
- Click Add user account
- Set a username and password, then set Host name to
%(this allows access from any IP) - Grant the necessary permissions (e.g., full access to your project database) and click Execute
2.3 Restart WAMP services
Right-click the WAMP tray icon and select Restart All Services to apply all your config changes.
3. Update the host computer’s firewall
Firewalls block external connections by default, so you need to let WAMP through:
- Open Windows Defender Firewall (or your third-party firewall)
- Create inbound rules to allow TCP traffic on:
- Apache’s port (default 80, or 8080 if you changed it)
- MySQL’s default port 3306
- Alternatively, when Windows prompts you about allowing WAMP access after your first restart, select "Allow access" and check both Private and Public networks (if applicable)
4. Access WAMP from the second computer
- First, get the host computer’s local IP: run
ipconfigon the WAMP machine and copy its IPv4 address (e.g.,192.168.1.105) - On the second computer’s browser:
- To access the main WAMP dashboard:
http://[HOST_IP](orhttp://[HOST_IP]:8080if you changed the port) - To access phpMyAdmin:
http://[HOST_IP]/phpmyadmin(use the remote MySQL user you created earlier to log in) - To access your project:
http://[HOST_IP]/your-project-folder-name
- To access the main WAMP dashboard:
5. Pro tips for reliability & security
- Set a static IP for the WAMP host: If the host’s IP changes after a restart, the second computer won’t be able to connect. You can set this in your router (reserved IP) or manually via Windows’ network settings.
- Restrict access for security: Instead of
Require all granted, you can limit access to only the second computer’s IP withRequire ip [SECOND_COMPUTER_IP]or its subnet (e.g.,192.168.1.0/24) - If your computers are on separate networks (different routers), you’ll need port forwarding on the host’s router—this is more complex, so start with the same LAN setup first.
内容的提问来源于stack exchange,提问作者Ossama Rafique
相关产品推荐
相关产品推荐

