How to Make a joint Localhost for two PC connected to a modem with Xampp or other Web Server applications?

5,958

You cannot use localhost for access to another computer. It's a loopback address of the network card which means, in this case, you will be redirected to the local computer if you try to use it.

Since you're connected to the same modem you should be on the same network. You have to use the IP address or setup a DNS record for the computer with xampp installed and access it through that.

For example:
PC1 IP address: 192.168.0.10
PC2 IP address: 192.168.0.20

Configure apache to allow access from 192.168.0.20 in the \xampp\apache\conf\httpd.conf file. Browse to http://192.168.0.10/ or for example http://192.168.0.10/phpmyadmin, from PC2. You could also allow network access to the htdocs\ folder on PC1 and access it from PC2 by typing into explorer or run prompt \\192.168.0.10\htdocs\that way to modify files or folders.

Not neccesary but easier than typing in IP addresses:
If you have DNS on your modem you can configure an A-record for it there or you could simply go to the %WINDIR%\system32\drivers\etc\ folder on PC2 and configure the hosts file with a record pointing to 192.168.0.10(PC1).

More reading on networking:
http://en.wikipedia.org/wiki/IPv4
http://en.wikipedia.org/wiki/Hosts_%28file%29

Share:
5,958

Related videos on Youtube

Alireza Sheikholmolouki
Author by

Alireza Sheikholmolouki

I'm Working on Coding in newest ways of Web Design also Want to be on Google Inc A.S.A.P;)

Updated on September 18, 2022

Comments

  • Alireza Sheikholmolouki
    Alireza Sheikholmolouki over 1 year

    I have two personal computers that are connected to the same modem and I want to make a joint localhost For both of them.

    for example i have a localhost on pc1 made by xampp and have a phpmyadmin and 'htdocs'folder, including databases and files. now we want to join them so if we went to localhost on pc2 it showed the same as pc1 and they have common databases. so if we change databases from pc2, the changes can be seen on pc1..

    more important part is common phpmyadmin(databases) and in second priority if it's possible the common files.