You can get an error, because IP address is random (and the generated address in this case is private)
You can change the PHP code to get Real IP
If error, you can refresh the webpage to generate a new IP address
If you display the real IP and regarding GDPR, it's not an issue to see the IP.
It's YOUR IP and it's never logged...