I have a number of instances behind a loadbalancer. Is it possible to detect the name of the machine (e.g. ec2-XXX-XX-XXX-XXX.compute-1.amazonaws.com) in PHP for debugging? I looked through phpinfo() and it doesn't seem to have any kind of machine specific information.
Tell me more
×
Server Fault is a question and answer site for
professional system and network administrators. It's 100% free, no registration required.
|
you'll have to use IP seems a little more involved. Depends on how they've got things set up but you can try
|
||||
|
This should do it: http://php.net/manual/en/reserved.variables.server.php
|
|||
|
|
IIRC, the public hostname actually doesn't exist anywhere on the server. It's stored in EC2's metadata, which can be fetched from 169.254.169.254 on any EC2 instance.
|
|||
|
|