I would like to build a local network consisting of several computers each of which is running a web server. These web-servers should communicate with each other. But the problem is that IP addresses could be different each time I start the network. So, every server does not know how to find another server.

I know that, in similar situation, people used Java in combination with zeroconf. Zeroconf finds all computers present in the network automatically and gives this information, in same way, to Java. Can I do something similar in PHP?

  • What router are you using? Most, if not all, allow for using names rather than IP addresses. Some, if not all, will even automatically honour any name a computer has assigned to itself (as long as it is unique). And if all else fails then most, if not all, routers will allow for static IP addresses... Hence: more details please! – Arjan Mar 1 '10 at 14:02

The PECL has a Zeroconf extension you could try out. Zeroconf/mDNS is not specific to Java. However, I would recommend using static IP addresses with a known configuration rather than having the additional dependency of Zeroconf.


Apache has an Avahi/mDNS plugin called dnssd that can help you with this.


I think that you should take a step back and fix the real problem. If you have several servers, each of which need to find each other, then you should assign them static IPs. That is exactly the problem that setting a server to have a static IP is designed to fix, after all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.