0

How does one get the server IP address of the server you are on to appear at http://examplehost.com/admin/reports/status/php -- at the very bottom ? I keep getting 127.0.0.1. This is on two web servers that are behind a load balancer.

  • You balancer is probably configured to not pass the original IP along to the web server. – Letharion May 18 '12 at 20:48
  • I am not looking for the original or client IP. I am looking for the IP of the server that executed the php script (_: – KM. May 18 '12 at 22:52
  • Ops, sorry about that. :) Seems I did the same mistake as Johnathan Elmore below. – Letharion May 19 '12 at 7:46
1

The admin/reports/status/php is actually the output of phpinfo() and it simply shows your PHP configuration summary.

https://stackoverflow.com/questions/3202872/php-serverserver-addr-variable-always-returns-127-0-0-1 suggests using this code to get the real IP:

getHostByName(php_uname('n'));
| improve this answer | |

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.