Get the Server’s IP Address with PHP

If there’s a need to get the server’s IP address with PHP, the answer is simple:

<?php echo $_SERVER['SERVER_ADDR'] ?>

Actually that looks pretty much like the getting the user’s IP address:

<?php echo $_SERVER['REMOTE_ADDR'] ?>

Leave a Reply

Your email address will not be published. Required fields are marked *