How to generate unique ids for my scaled Servers with PHP?
I'm using the PHP function uniqid() on my server. It should be something like a microtime. So I think it is unique FOR ONE server. Is it correct? How can I get a unique id if I scale my server with a loadbalancer? I need a string with less than 31 characters. Thanks I would suggest combining multiple sources of entropy. This way you wouldn't rely on some assumptions (local IP address being different) or luck (two servers won't do the same thing exactly at the same nanotime). Things that come to my mind (and are pretty portable, not platform specific): nanotime, open temp directory in file