<?php

print $_SERVER['REMOTE_ADDR'];

<?php

print $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['HTTP_X_REAL_IP'] ?? $_SERVER['REMOTE_ADDR'];

Fix IP retrieval for PHP server
Fix IP retrieval for PHP server