PHP $_SERVER['REMOTE_ADDR'] shows a Clouflare IP adress


I tried to get the visitor’s IP address in PHP with this code:

echo $ip;

It should show my IP adress, but the result is .
I opened the site on my mobile, but it shows the same.
Any help?


You need to rewrite the IP addresses. Assuming you are on Apache have a look at mod_remoteip. Also, search the forum for this here, as there are plenty of examples.


I changed back my nameservers to the original, and now it’s working.
But now I can’t use cloudflare…


Ehm, you didnt address my response.


Because I don’t have permission to do that.
Only mail, nameserver and contacts.


Thats why are not addressing my response?

Which settings? The webserver’s? In that case you need to contact your host.


Use HTTP_CF_CONNECTING_IP instead of REMOTE_ADDR :slight_smile:

1 Like
closed #8

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.